From 5b67f9e010f3ca201ba1ac168dccb95918cd0362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=2E=20Hansen?= Date: Mon, 4 Sep 2023 21:12:31 +0200 Subject: [PATCH 1/2] fix: --dependency flag is respected by git pulling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André S. Hansen --- cmd/run_pipeline.go | 2 +- pkg/devspace/dependency/manager.go | 5 +++-- pkg/devspace/dependency/resolver.go | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/run_pipeline.go b/cmd/run_pipeline.go index 8d55d8dc08..048a5662ac 100644 --- a/cmd/run_pipeline.go +++ b/cmd/run_pipeline.go @@ -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") } diff --git a/pkg/devspace/dependency/manager.go b/pkg/devspace/dependency/manager.go index b8d0d82236..0491d86991 100644 --- a/pkg/devspace/dependency/manager.go +++ b/pkg/devspace/dependency/manager.go @@ -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" @@ -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. @@ -39,7 +40,7 @@ func NewManagerWithParser(ctx devspacecontext.Context, configOptions *loader.Con type ResolveOptions struct { SkipDependencies []string - Dependencies []string + Dependencies []string // Same as DependencyOptions.Only, either should be renamed } func (m *manager) ResolveAll(ctx devspacecontext.Context, options ResolveOptions) ([]types.Dependency, error) { diff --git a/pkg/devspace/dependency/resolver.go b/pkg/devspace/dependency/resolver.go index da19648a73..0bd367ffb8 100644 --- a/pkg/devspace/dependency/resolver.go +++ b/pkg/devspace/dependency/resolver.go @@ -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" ) @@ -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 From b81076bb12831989e832913fc0d2adbb0cc4412e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=2E=20Hansen?= Date: Tue, 5 Sep 2023 19:07:59 +0200 Subject: [PATCH 2/2] Removed comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André S. Hansen --- pkg/devspace/dependency/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/devspace/dependency/manager.go b/pkg/devspace/dependency/manager.go index 0491d86991..e793980bf9 100644 --- a/pkg/devspace/dependency/manager.go +++ b/pkg/devspace/dependency/manager.go @@ -40,7 +40,7 @@ func NewManagerWithParser(ctx devspacecontext.Context, configOptions *loader.Con type ResolveOptions struct { SkipDependencies []string - Dependencies []string // Same as DependencyOptions.Only, either should be renamed + Dependencies []string } func (m *manager) ResolveAll(ctx devspacecontext.Context, options ResolveOptions) ([]types.Dependency, error) {