Skip to content

Commit

Permalink
Merge pull request #2708 from Andrioden/main
Browse files Browse the repository at this point in the history
fix: --dependency flag is respected by dependency resolving
  • Loading branch information
lizardruss authored Sep 5, 2023
2 parents fe6d264 + b81076b commit c477eaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/run_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func initialize(ctx context.Context, f factory.Factory, options *CommandOptions,
}

// resolve dependencies
dependencies, err := f.NewDependencyManager(devCtx, options.ConfigOptions).ResolveAll(devCtx, dependency.ResolveOptions{SkipDependencies: options.DependencyOptions.Exclude})
dependencies, err := f.NewDependencyManager(devCtx, options.ConfigOptions).ResolveAll(devCtx, dependency.ResolveOptions{SkipDependencies: options.DependencyOptions.Exclude, Dependencies: options.DependencyOptions.Only})
if err != nil {
return nil, errors.Wrap(err, "deploy dependencies")
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/devspace/dependency/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package dependency

import (
"bytes"
"strings"

"github.com/loft-sh/devspace/pkg/devspace/build"
"github.com/loft-sh/devspace/pkg/devspace/config/loader"
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
Expand All @@ -11,7 +13,6 @@ import (
"github.com/loft-sh/devspace/pkg/util/log"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"strings"
)

// Manager can update, build, deploy and purge dependencies.
Expand Down
5 changes: 5 additions & 0 deletions pkg/devspace/dependency/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/loft-sh/devspace/pkg/devspace/dependency/types"
"github.com/loft-sh/devspace/pkg/devspace/dependency/util"
"github.com/loft-sh/devspace/pkg/devspace/kubectl"
"github.com/loft-sh/devspace/pkg/util/stringutil"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -120,6 +121,10 @@ func (r *resolver) resolveRecursive(ctx devspacecontext.Context, basePath, paren
continue
}

if len(options.Dependencies) > 0 && !stringutil.Contains(options.Dependencies, dependencyConfig.Name) {
continue
}

if dependencyConfig.Disabled {
ctx.Log().Debugf("Skip dependency %s, because it is disabled", dependencyConfig.Name)
continue
Expand Down

0 comments on commit c477eaf

Please sign in to comment.