parent
							
								
									8afffa5c98
								
							
						
					
					
						commit
						a783ae1242
					
				|  | @ -59,7 +59,6 @@ jobs: | ||||||
|             plugin-secrets-version: 3.15.0 |             plugin-secrets-version: 3.15.0 | ||||||
|             plugin-diff-version: 3.8.1 |             plugin-diff-version: 3.8.1 | ||||||
|             extra-helmfile-flags: '' |             extra-helmfile-flags: '' | ||||||
|             v1mode: '' |  | ||||||
|           - helm-version: v3.16.4 |           - helm-version: v3.16.4 | ||||||
|             kustomize-version: v5.4.3 |             kustomize-version: v5.4.3 | ||||||
|             # We assume that the helm-secrets plugin is supposed to |             # We assume that the helm-secrets plugin is supposed to | ||||||
|  | @ -70,26 +69,16 @@ jobs: | ||||||
|             plugin-secrets-version: 4.6.0 |             plugin-secrets-version: 4.6.0 | ||||||
|             plugin-diff-version: 3.9.14 |             plugin-diff-version: 3.9.14 | ||||||
|             extra-helmfile-flags: '' |             extra-helmfile-flags: '' | ||||||
|             v1mode: '' |  | ||||||
|           - helm-version: v3.17.0 |           - helm-version: v3.17.0 | ||||||
|             kustomize-version: v5.2.1 |             kustomize-version: v5.2.1 | ||||||
|             plugin-secrets-version: 3.15.0 |             plugin-secrets-version: 3.15.0 | ||||||
|             plugin-diff-version: 3.8.1 |             plugin-diff-version: 3.8.1 | ||||||
|             extra-helmfile-flags: '' |             extra-helmfile-flags: '' | ||||||
|             v1mode: '' |  | ||||||
|           - helm-version: v3.17.0 |           - helm-version: v3.17.0 | ||||||
|             kustomize-version: v5.4.3 |             kustomize-version: v5.4.3 | ||||||
|             plugin-secrets-version: 4.6.0 |             plugin-secrets-version: 4.6.0 | ||||||
|             plugin-diff-version: 3.9.14 |             plugin-diff-version: 3.9.14 | ||||||
|             extra-helmfile-flags: '' |             extra-helmfile-flags: '' | ||||||
|             v1mode: '' |  | ||||||
|           # Helmfile v1 |  | ||||||
|           - helm-version: v3.17.0 |  | ||||||
|             kustomize-version: v5.4.3 |  | ||||||
|             plugin-secrets-version: 4.6.0 |  | ||||||
|             plugin-diff-version: 3.9.14 |  | ||||||
|             extra-helmfile-flags: '' |  | ||||||
|             v1mode: 'true' |  | ||||||
|           # In case you need to test some optional helmfile features, |           # In case you need to test some optional helmfile features, | ||||||
|           # enable it via extra-helmfile-flags below. |           # enable it via extra-helmfile-flags below. | ||||||
|           - helm-version: v3.17.0 |           - helm-version: v3.17.0 | ||||||
|  | @ -97,7 +86,6 @@ jobs: | ||||||
|             plugin-secrets-version: 4.6.0 |             plugin-secrets-version: 4.6.0 | ||||||
|             plugin-diff-version: 3.9.14 |             plugin-diff-version: 3.9.14 | ||||||
|             extra-helmfile-flags: '--enable-live-output' |             extra-helmfile-flags: '--enable-live-output' | ||||||
|             v1mode: '' |  | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-go@v5 |       - uses: actions/setup-go@v5 | ||||||
|  | @ -127,7 +115,6 @@ jobs: | ||||||
|           HELMFILE_HELM3: 1 |           HELMFILE_HELM3: 1 | ||||||
|           TERM: xterm |           TERM: xterm | ||||||
|           EXTRA_HELMFILE_FLAGS: ${{ matrix.extra-helmfile-flags }} |           EXTRA_HELMFILE_FLAGS: ${{ matrix.extra-helmfile-flags }} | ||||||
|           HELMFILE_V1MODE: ${{ matrix.v1mode }} |  | ||||||
| 
 | 
 | ||||||
|   e2e_tests: |   e2e_tests: | ||||||
|     needs: tests |     needs: tests | ||||||
|  |  | ||||||
|  | @ -16,7 +16,6 @@ permissions: | ||||||
| 
 | 
 | ||||||
| env: | env: | ||||||
|   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|   HELMFILE_V1MODE: ${{ startsWith(github.ref, 'refs/tags/v1') }} |  | ||||||
|   SNAPSHOT: ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }} |   SNAPSHOT: ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }} | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|  |  | ||||||
|  | @ -1,8 +1,5 @@ | ||||||
| version: 2 | version: 2 | ||||||
| project_name: helmfile | project_name: helmfile | ||||||
| env: |  | ||||||
|   # We default to non-v1 mode (=helmfile v0.x behavior) when HELMFILE_V1MODE is not set |  | ||||||
|   - HELMFILE_V1MODE={{ if index .Env "HELMFILE_V1MODE"  }}{{ .Env.HELMFILE_V1MODE }}{{ else }}false{{ end }} |  | ||||||
| builds: | builds: | ||||||
|   - id: helmfile |   - id: helmfile | ||||||
|     main: . |     main: . | ||||||
|  | @ -15,7 +12,6 @@ builds: | ||||||
|       - -X go.szostok.io/version.commit={{.FullCommit}} |       - -X go.szostok.io/version.commit={{.FullCommit}} | ||||||
|       - -X go.szostok.io/version.commitDate={{.CommitDate}} |       - -X go.szostok.io/version.commitDate={{.CommitDate}} | ||||||
|       - -X go.szostok.io/version.dirtyBuild=false |       - -X go.szostok.io/version.dirtyBuild=false | ||||||
|       - -X github.com/helmfile/helmfile/pkg/runtime.v1Mode={{.Env.HELMFILE_V1MODE}} |  | ||||||
|     goos: |     goos: | ||||||
|       - darwin |       - darwin | ||||||
|       - linux |       - linux | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										4
									
								
								Makefile
								
								
								
								
							|  | @ -25,10 +25,6 @@ build: | ||||||
| 	go build -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS} | 	go build -ldflags="$(GO_BUILD_VERSION_LDFLAGS)" ${TARGETS} | ||||||
| .PHONY: build | .PHONY: build | ||||||
| 
 | 
 | ||||||
| build-v1: |  | ||||||
| 	go build -ldflags="$(GO_BUILD_VERSION_LDFLAGS) -X github.com/helmfile/helmfile/pkg/runtime.v1Mode=true" ${TARGETS} |  | ||||||
| .PHONY: build-v1 |  | ||||||
| 
 |  | ||||||
| generate: | generate: | ||||||
| 	go generate ${PKGS} | 	go generate ${PKGS} | ||||||
| .PHONY: generate | .PHONY: generate | ||||||
|  |  | ||||||
|  | @ -5,7 +5,6 @@ import ( | ||||||
| 
 | 
 | ||||||
| 	"github.com/helmfile/helmfile/pkg/app" | 	"github.com/helmfile/helmfile/pkg/app" | ||||||
| 	"github.com/helmfile/helmfile/pkg/config" | 	"github.com/helmfile/helmfile/pkg/config" | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // NewApplyCmd returns apply subcmd
 | // NewApplyCmd returns apply subcmd
 | ||||||
|  | @ -44,12 +43,6 @@ func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command { | ||||||
| 	f.StringVar(&applyOptions.DiffArgs, "diff-args", "", `pass args to helm helm-diff`) | 	f.StringVar(&applyOptions.DiffArgs, "diff-args", "", `pass args to helm helm-diff`) | ||||||
| 	f.StringVar(&applyOptions.SyncArgs, "sync-args", "", `pass args to helm upgrade`) | 	f.StringVar(&applyOptions.SyncArgs, "sync-args", "", `pass args to helm upgrade`) | ||||||
| 	f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec") | 	f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec") | ||||||
| 	if !runtime.V1Mode { |  | ||||||
| 		// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 		f.BoolVar(&applyOptions.RetainValuesFiles, "retain-values-files", false, "DEPRECATED: Use skip-cleanup instead") |  | ||||||
| 		_ = f.MarkDeprecated("retain-values-files", "Use skip-cleanup instead") |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	f.BoolVar(&applyOptions.SkipCleanup, "skip-cleanup", false, "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security") | 	f.BoolVar(&applyOptions.SkipCleanup, "skip-cleanup", false, "Stop cleaning up temporary values generated by helmfile and helm-secrets. Useful for debugging. Don't use in production for security") | ||||||
| 	f.BoolVar(&applyOptions.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present") | 	f.BoolVar(&applyOptions.SkipCRDs, "skip-crds", false, "if set, no CRDs will be installed on sync. By default, CRDs are installed if not already present") | ||||||
| 	f.BoolVar(&applyOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`) | 	f.BoolVar(&applyOptions.SkipNeeds, "skip-needs", true, `do not automatically include releases from the target release's "needs" when --selector/-l flag is provided. Does nothing when --selector/-l flag is not provided. Defaults to true when --include-needs or --include-transitive-needs is not provided`) | ||||||
|  |  | ||||||
|  | @ -1,41 +0,0 @@ | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| package cmd |  | ||||||
| 
 |  | ||||||
| import ( |  | ||||||
| 	"github.com/spf13/cobra" |  | ||||||
| 
 |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/app" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/config" |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| // NewChartsCmd returns charts subcmd
 |  | ||||||
| func NewChartsCmd(globalCfg *config.GlobalImpl) *cobra.Command { |  | ||||||
| 	chartsOptions := config.NewChartsOptions() |  | ||||||
| 
 |  | ||||||
| 	cmd := &cobra.Command{ |  | ||||||
| 		Use:   "charts", |  | ||||||
| 		Short: "DEPRECATED: sync releases from state file (helm upgrade --install)", |  | ||||||
| 		RunE: func(cmd *cobra.Command, args []string) error { |  | ||||||
| 			chartsImpl := config.NewChartsImpl(globalCfg, chartsOptions) |  | ||||||
| 			err := config.NewCLIConfigImpl(chartsImpl.GlobalImpl) |  | ||||||
| 			if err != nil { |  | ||||||
| 				return err |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if err := chartsImpl.ValidateConfig(); err != nil { |  | ||||||
| 				return err |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			a := app.New(chartsImpl) |  | ||||||
| 			return toCLIError(chartsImpl.GlobalImpl, a.DeprecatedSyncCharts(chartsImpl)) |  | ||||||
| 		}, |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	f := cmd.Flags() |  | ||||||
| 	f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec") |  | ||||||
| 	f.StringArrayVar(&chartsOptions.Set, "set", nil, "additional values to be merged into the helm command --set flag") |  | ||||||
| 	f.StringArrayVar(&chartsOptions.Values, "values", nil, "additional value files to be merged into the helm command --values flag") |  | ||||||
| 	f.IntVar(&chartsOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited") |  | ||||||
| 
 |  | ||||||
| 	return cmd |  | ||||||
| } |  | ||||||
|  | @ -1,44 +0,0 @@ | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| package cmd |  | ||||||
| 
 |  | ||||||
| import ( |  | ||||||
| 	"github.com/spf13/cobra" |  | ||||||
| 
 |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/app" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/config" |  | ||||||
| ) |  | ||||||
| 
 |  | ||||||
| // NewDeleteCmd returns delete subcmd
 |  | ||||||
| func NewDeleteCmd(globalCfg *config.GlobalImpl) *cobra.Command { |  | ||||||
| 	deleteOptions := config.NewDeleteOptions() |  | ||||||
| 
 |  | ||||||
| 	cmd := &cobra.Command{ |  | ||||||
| 		Use:   "delete", |  | ||||||
| 		Short: "DEPRECATED: delete releases from state file (helm delete)", |  | ||||||
| 		RunE: func(cmd *cobra.Command, args []string) error { |  | ||||||
| 			deleteImpl := config.NewDeleteImpl(globalCfg, deleteOptions) |  | ||||||
| 			err := config.NewCLIConfigImpl(deleteImpl.GlobalImpl) |  | ||||||
| 			if err != nil { |  | ||||||
| 				return err |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			if err := deleteImpl.ValidateConfig(); err != nil { |  | ||||||
| 				return err |  | ||||||
| 			} |  | ||||||
| 
 |  | ||||||
| 			a := app.New(deleteImpl) |  | ||||||
| 			return toCLIError(deleteImpl.GlobalImpl, a.Delete(deleteImpl)) |  | ||||||
| 		}, |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	f := cmd.Flags() |  | ||||||
| 	f.StringVar(&globalCfg.GlobalOptions.Args, "args", "", "pass args to helm exec") |  | ||||||
| 	f.StringVar(&deleteOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background") |  | ||||||
| 	f.IntVar(&deleteOptions.Concurrency, "concurrency", 0, "maximum number of concurrent helm processes to run, 0 is unlimited") |  | ||||||
| 	f.BoolVar(&deleteOptions.Purge, "purge", false, "purge releases i.e. free release names and histories") |  | ||||||
| 	f.BoolVar(&deleteOptions.SkipCharts, "skip-charts", false, "don't prepare charts when deleting releases") |  | ||||||
| 	f.BoolVar(&deleteOptions.DeleteWait, "deleteWait", false, `override helmDefaults.wait setting "helm uninstall --wait"`) |  | ||||||
| 	f.IntVar(&deleteOptions.DeleteTimeout, "deleteTimeout", 300, `time in seconds to wait for helm uninstall, default: 300`) |  | ||||||
| 
 |  | ||||||
| 	return cmd |  | ||||||
| } |  | ||||||
|  | @ -109,14 +109,6 @@ func NewRootCmd(globalConfig *config.GlobalOptions) (*cobra.Command, error) { | ||||||
| 		), | 		), | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	if !runtime.V1Mode { |  | ||||||
| 		cmd.AddCommand( |  | ||||||
| 			NewChartsCmd(globalImpl), |  | ||||||
| 			NewDeleteCmd(globalImpl), |  | ||||||
| 		) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return cmd, nil | 	return cmd, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -557,7 +557,6 @@ Helmfile uses some OS environment variables to override default behaviour: | ||||||
| * `HELMFILE_ENVIRONMENT` - specify [Helmfile environment](https://helmfile.readthedocs.io/en/latest/#environment), it has lower priority than CLI argument `--environment` | * `HELMFILE_ENVIRONMENT` - specify [Helmfile environment](https://helmfile.readthedocs.io/en/latest/#environment), it has lower priority than CLI argument `--environment` | ||||||
| * `HELMFILE_TEMPDIR` - specify directory to store temporary files | * `HELMFILE_TEMPDIR` - specify directory to store temporary files | ||||||
| * `HELMFILE_UPGRADE_NOTICE_DISABLED` - expecting any non-empty value to skip the check for the latest version of Helmfile in [helmfile version](https://helmfile.readthedocs.io/en/latest/#version) | * `HELMFILE_UPGRADE_NOTICE_DISABLED` - expecting any non-empty value to skip the check for the latest version of Helmfile in [helmfile version](https://helmfile.readthedocs.io/en/latest/#version) | ||||||
| * `HELMFILE_V1MODE` - Helmfile v0.x behaves like v1.x with `true`, Helmfile v1.x behaves like v0.x with `false` as value |  | ||||||
| * `HELMFILE_GOCCY_GOYAML` - use *goccy/go-yaml* instead of *gopkg.in/yaml.v2*.  It's `false` by default in Helmfile v0.x and `true` by default for Helmfile v1.x. | * `HELMFILE_GOCCY_GOYAML` - use *goccy/go-yaml* instead of *gopkg.in/yaml.v2*.  It's `false` by default in Helmfile v0.x and `true` by default for Helmfile v1.x. | ||||||
| * `HELMFILE_CACHE_HOME` - specify directory to store cached files for remote operations | * `HELMFILE_CACHE_HOME` - specify directory to store cached files for remote operations | ||||||
| * `HELMFILE_FILE_PATH` - specify the path to the helmfile.yaml file | * `HELMFILE_FILE_PATH` - specify the path to the helmfile.yaml file | ||||||
|  |  | ||||||
|  | @ -20,7 +20,6 @@ import ( | ||||||
| 	"github.com/helmfile/helmfile/pkg/helmexec" | 	"github.com/helmfile/helmfile/pkg/helmexec" | ||||||
| 	"github.com/helmfile/helmfile/pkg/plugins" | 	"github.com/helmfile/helmfile/pkg/plugins" | ||||||
| 	"github.com/helmfile/helmfile/pkg/remote" | 	"github.com/helmfile/helmfile/pkg/remote" | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/state" | 	"github.com/helmfile/helmfile/pkg/state" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | @ -139,25 +138,6 @@ func (a *App) Repos(c ReposConfigProvider) error { | ||||||
| 	}, c.IncludeTransitiveNeeds(), SetFilter(true)) | 	}, c.IncludeTransitiveNeeds(), SetFilter(true)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| func (a *App) DeprecatedSyncCharts(c DeprecatedChartsConfigProvider) error { |  | ||||||
| 	return a.ForEachState(func(run *Run) (_ bool, errs []error) { |  | ||||||
| 		err := run.withPreparedCharts("charts", state.ChartPrepareOptions{ |  | ||||||
| 			SkipRepos:   true, |  | ||||||
| 			SkipDeps:    true, |  | ||||||
| 			Concurrency: 2, |  | ||||||
| 		}, func() { |  | ||||||
| 			errs = run.DeprecatedSyncCharts(c) |  | ||||||
| 		}) |  | ||||||
| 
 |  | ||||||
| 		if err != nil { |  | ||||||
| 			errs = append(errs, err) |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		return |  | ||||||
| 	}, c.IncludeTransitiveNeeds(), SetFilter(true)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (a *App) Diff(c DiffConfigProvider) error { | func (a *App) Diff(c DiffConfigProvider) error { | ||||||
| 	var allDiffDetectedErrs []error | 	var allDiffDetectedErrs []error | ||||||
| 
 | 
 | ||||||
|  | @ -409,7 +389,7 @@ func (a *App) Apply(c ApplyConfigProvider) error { | ||||||
| 
 | 
 | ||||||
| 	var opts []LoadOption | 	var opts []LoadOption | ||||||
| 
 | 
 | ||||||
| 	opts = append(opts, SetRetainValuesFiles(c.RetainValuesFiles() || c.SkipCleanup())) | 	opts = append(opts, SetRetainValuesFiles(c.SkipCleanup())) | ||||||
| 
 | 
 | ||||||
| 	err := a.ForEachState(func(run *Run) (ok bool, errs []error) { | 	err := a.ForEachState(func(run *Run) (ok bool, errs []error) { | ||||||
| 		includeCRDs := !c.SkipCRDs() | 		includeCRDs := !c.SkipCRDs() | ||||||
|  | @ -421,7 +401,7 @@ func (a *App) Apply(c ApplyConfigProvider) error { | ||||||
| 			Wait:                   c.Wait(), | 			Wait:                   c.Wait(), | ||||||
| 			WaitForJobs:            c.WaitForJobs(), | 			WaitForJobs:            c.WaitForJobs(), | ||||||
| 			IncludeCRDs:            &includeCRDs, | 			IncludeCRDs:            &includeCRDs, | ||||||
| 			SkipCleanup:            c.RetainValuesFiles() || c.SkipCleanup(), | 			SkipCleanup:            c.SkipCleanup(), | ||||||
| 			Validate:               c.Validate(), | 			Validate:               c.Validate(), | ||||||
| 			Concurrency:            c.Concurrency(), | 			Concurrency:            c.Concurrency(), | ||||||
| 			IncludeTransitiveNeeds: c.IncludeNeeds(), | 			IncludeTransitiveNeeds: c.IncludeNeeds(), | ||||||
|  | @ -473,31 +453,6 @@ func (a *App) Status(c StatusesConfigProvider) error { | ||||||
| 	}, false, SetFilter(true)) | 	}, false, SetFilter(true)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| func (a *App) Delete(c DeleteConfigProvider) error { |  | ||||||
| 	return a.ForEachState(func(run *Run) (ok bool, errs []error) { |  | ||||||
| 		if !c.SkipCharts() { |  | ||||||
| 			err := run.withPreparedCharts("delete", state.ChartPrepareOptions{ |  | ||||||
| 				SkipRepos:     c.SkipRefresh() || c.SkipDeps(), |  | ||||||
| 				SkipRefresh:   c.SkipRefresh(), |  | ||||||
| 				SkipDeps:      c.SkipDeps(), |  | ||||||
| 				Concurrency:   c.Concurrency(), |  | ||||||
| 				DeleteWait:    c.DeleteWait(), |  | ||||||
| 				DeleteTimeout: c.DeleteTimeout(), |  | ||||||
| 			}, func() { |  | ||||||
| 				ok, errs = a.delete(run, c.Purge(), c) |  | ||||||
| 			}) |  | ||||||
| 
 |  | ||||||
| 			if err != nil { |  | ||||||
| 				errs = append(errs, err) |  | ||||||
| 			} |  | ||||||
| 		} else { |  | ||||||
| 			ok, errs = a.delete(run, c.Purge(), c) |  | ||||||
| 		} |  | ||||||
| 		return |  | ||||||
| 	}, false, SetReverse(true)) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (a *App) Destroy(c DestroyConfigProvider) error { | func (a *App) Destroy(c DestroyConfigProvider) error { | ||||||
| 	return a.ForEachState(func(run *Run) (ok bool, errs []error) { | 	return a.ForEachState(func(run *Run) (ok bool, errs []error) { | ||||||
| 		if !c.SkipCharts() { | 		if !c.SkipCharts() { | ||||||
|  | @ -1258,16 +1213,6 @@ func (a *App) findDesiredStateFiles(specifiedPath string, opts LoadOpts) ([]stri | ||||||
| 
 | 
 | ||||||
| 		case a.fs.FileExistsAt(DefaultGotmplHelmfile): | 		case a.fs.FileExistsAt(DefaultGotmplHelmfile): | ||||||
| 			defaultFile = DefaultGotmplHelmfile | 			defaultFile = DefaultGotmplHelmfile | ||||||
| 
 |  | ||||||
| 		// TODO: Remove this block when we remove v0 code
 |  | ||||||
| 		case !runtime.V1Mode && a.fs.FileExistsAt(DeprecatedHelmfile): |  | ||||||
| 			a.Logger.Warnf( |  | ||||||
| 				"warn: %s is being loaded: %s is deprecated in favor of %s. See https://github.com/roboll/helmfile/issues/25 for more information", |  | ||||||
| 				DeprecatedHelmfile, |  | ||||||
| 				DeprecatedHelmfile, |  | ||||||
| 				DefaultHelmfile, |  | ||||||
| 			) |  | ||||||
| 			defaultFile = DeprecatedHelmfile |  | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		switch { | 		switch { | ||||||
|  | @ -1432,7 +1377,7 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) { | ||||||
| 		Context:                 c.Context(), | 		Context:                 c.Context(), | ||||||
| 		Output:                  c.DiffOutput(), | 		Output:                  c.DiffOutput(), | ||||||
| 		Set:                     c.Set(), | 		Set:                     c.Set(), | ||||||
| 		SkipCleanup:             c.RetainValuesFiles() || c.SkipCleanup(), | 		SkipCleanup:             c.SkipCleanup(), | ||||||
| 		SkipDiffOnInstall:       c.SkipDiffOnInstall(), | 		SkipDiffOnInstall:       c.SkipDiffOnInstall(), | ||||||
| 		ReuseValues:             c.ReuseValues(), | 		ReuseValues:             c.ReuseValues(), | ||||||
| 		ResetValues:             c.ResetValues(), | 		ResetValues:             c.ResetValues(), | ||||||
|  | @ -1543,7 +1488,7 @@ Do you really want to apply? | ||||||
| 
 | 
 | ||||||
| 				syncOpts := &state.SyncOpts{ | 				syncOpts := &state.SyncOpts{ | ||||||
| 					Set:                  c.Set(), | 					Set:                  c.Set(), | ||||||
| 					SkipCleanup:          c.RetainValuesFiles() || c.SkipCleanup(), | 					SkipCleanup:          c.SkipCleanup(), | ||||||
| 					SkipCRDs:             c.SkipCRDs(), | 					SkipCRDs:             c.SkipCRDs(), | ||||||
| 					Wait:                 c.Wait(), | 					Wait:                 c.Wait(), | ||||||
| 					WaitForJobs:          c.WaitForJobs(), | 					WaitForJobs:          c.WaitForJobs(), | ||||||
|  |  | ||||||
|  | @ -2213,9 +2213,6 @@ type applyConfig struct { | ||||||
| 	cascade string | 	cascade string | ||||||
| 	values  []string | 	values  []string | ||||||
| 
 | 
 | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	retainValuesFiles bool |  | ||||||
| 
 |  | ||||||
| 	set                     []string | 	set                     []string | ||||||
| 	validate                bool | 	validate                bool | ||||||
| 	skipCleanup             bool | 	skipCleanup             bool | ||||||
|  | @ -2376,11 +2373,6 @@ func (a applyConfig) Logger() *zap.SugaredLogger { | ||||||
| 	return a.logger | 	return a.logger | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| func (a applyConfig) RetainValuesFiles() bool { |  | ||||||
| 	return a.retainValuesFiles |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (a applyConfig) SkipDiffOnInstall() bool { | func (a applyConfig) SkipDiffOnInstall() bool { | ||||||
| 	return a.skipDiffOnInstall | 	return a.skipDiffOnInstall | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -25,15 +25,6 @@ type ConfigProvider interface { | ||||||
| 	loggingConfig | 	loggingConfig | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| type DeprecatedChartsConfigProvider interface { |  | ||||||
| 	Values() []string |  | ||||||
| 
 |  | ||||||
| 	concurrencyConfig |  | ||||||
| 	loggingConfig |  | ||||||
| 	IncludeTransitiveNeeds() bool |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| type DepsConfigProvider interface { | type DepsConfigProvider interface { | ||||||
| 	Args() string | 	Args() string | ||||||
| 	SkipRepos() bool | 	SkipRepos() bool | ||||||
|  | @ -81,9 +72,6 @@ type ApplyConfigProvider interface { | ||||||
| 	Context() int | 	Context() int | ||||||
| 	DiffOutput() string | 	DiffOutput() string | ||||||
| 
 | 
 | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	RetainValuesFiles() bool |  | ||||||
| 
 |  | ||||||
| 	Validate() bool | 	Validate() bool | ||||||
| 	SkipCleanup() bool | 	SkipCleanup() bool | ||||||
| 	SkipDiffOnInstall() bool | 	SkipDiffOnInstall() bool | ||||||
|  | @ -166,23 +154,6 @@ type DiffConfigProvider interface { | ||||||
| 	valuesControlMode | 	valuesControlMode | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| type DeleteConfigProvider interface { |  | ||||||
| 	Args() string |  | ||||||
| 	Cascade() string |  | ||||||
| 
 |  | ||||||
| 	Purge() bool |  | ||||||
| 	SkipDeps() bool |  | ||||||
| 	SkipRefresh() bool |  | ||||||
| 	SkipCharts() bool |  | ||||||
| 	DeleteWait() bool |  | ||||||
| 	DeleteTimeout() int |  | ||||||
| 
 |  | ||||||
| 	interactive |  | ||||||
| 	loggingConfig |  | ||||||
| 	concurrencyConfig |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| type DestroyConfigProvider interface { | type DestroyConfigProvider interface { | ||||||
| 	Args() string | 	Args() string | ||||||
| 	Cascade() string | 	Cascade() string | ||||||
|  |  | ||||||
|  | @ -8,10 +8,7 @@ import ( | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const ( | const ( | ||||||
| 	DefaultHelmfile = "helmfile.yaml" | 	DefaultHelmfile              = "helmfile.yaml" | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	DeprecatedHelmfile = "charts.yaml" |  | ||||||
| 
 |  | ||||||
| 	DefaultHelmfileDirectory     = "helmfile.d" | 	DefaultHelmfileDirectory     = "helmfile.d" | ||||||
| 	ExperimentalSelectorExplicit = "explicit-selector-inheritance" // value to remove default selector inheritance to sub-helmfiles and use the explicit one
 | 	ExperimentalSelectorExplicit = "explicit-selector-inheritance" // value to remove default selector inheritance to sub-helmfiles and use the explicit one
 | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ import ( | ||||||
| 	"github.com/helmfile/helmfile/pkg/helmexec" | 	"github.com/helmfile/helmfile/pkg/helmexec" | ||||||
| 	"github.com/helmfile/helmfile/pkg/policy" | 	"github.com/helmfile/helmfile/pkg/policy" | ||||||
| 	"github.com/helmfile/helmfile/pkg/remote" | 	"github.com/helmfile/helmfile/pkg/remote" | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/state" | 	"github.com/helmfile/helmfile/pkg/state" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | @ -162,21 +161,14 @@ func (a *desiredStateLoader) underlying() *state.StateCreator { | ||||||
| func (a *desiredStateLoader) rawLoad(yaml []byte, baseDir, file string, evaluateBases bool, env, overrodeEnv *environment.Environment) (*state.HelmState, error) { | func (a *desiredStateLoader) rawLoad(yaml []byte, baseDir, file string, evaluateBases bool, env, overrodeEnv *environment.Environment) (*state.HelmState, error) { | ||||||
| 	var st *state.HelmState | 	var st *state.HelmState | ||||||
| 	var err error | 	var err error | ||||||
| 	if runtime.V1Mode { | 	merged, err := env.Merge(overrodeEnv) | ||||||
| 		st, err = a.underlying().ParseAndLoad(yaml, baseDir, file, a.env, false, evaluateBases, env, overrodeEnv) | 	if err != nil { | ||||||
| 		if err != nil { | 		return nil, err | ||||||
| 			return nil, err | 	} | ||||||
| 		} |  | ||||||
| 	} else { |  | ||||||
| 		merged, err := env.Merge(overrodeEnv) |  | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		st, err = a.underlying().ParseAndLoad(yaml, baseDir, file, a.env, false, evaluateBases, merged, nil) | 	st, err = a.underlying().ParseAndLoad(yaml, baseDir, file, a.env, false, evaluateBases, merged, nil) | ||||||
| 		if err != nil { | 	if err != nil { | ||||||
| 			return nil, err | 		return nil, err | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 	helmfiles, err := st.ExpandedHelmfiles() | 	helmfiles, err := st.ExpandedHelmfiles() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  | @ -207,7 +199,7 @@ func (ld *desiredStateLoader) load(env, overrodeEnv *environment.Environment, ba | ||||||
| 
 | 
 | ||||||
| 		var rawContent []byte | 		var rawContent []byte | ||||||
| 
 | 
 | ||||||
| 		if filepath.Ext(filename) == ".gotmpl" || !runtime.V1Mode { | 		if filepath.Ext(filename) == ".gotmpl" { | ||||||
| 			var yamlBuf *bytes.Buffer | 			var yamlBuf *bytes.Buffer | ||||||
| 			var err error | 			var err error | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -135,17 +135,6 @@ func (r *Run) Repos(c ReposConfigProvider) error { | ||||||
| 	return r.ctx.SyncReposOnce(r.state, r.helm) | 	return r.ctx.SyncReposOnce(r.state, r.helm) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| func (r *Run) DeprecatedSyncCharts(c DeprecatedChartsConfigProvider) []error { |  | ||||||
| 	st := r.state |  | ||||||
| 	helm := r.helm |  | ||||||
| 
 |  | ||||||
| 	affectedReleases := state.AffectedReleases{} |  | ||||||
| 	errs := st.SyncReleases(&affectedReleases, helm, c.Values(), c.Concurrency()) |  | ||||||
| 	affectedReleases.DisplayAffectedReleases(c.Logger()) |  | ||||||
| 	return errs |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func (r *Run) diff(triggerCleanupEvent bool, detailedExitCode bool, c DiffConfigProvider, diffOpts *state.DiffOpts) (*string, map[string]state.ReleaseSpec, map[string]state.ReleaseSpec, []error) { | func (r *Run) diff(triggerCleanupEvent bool, detailedExitCode bool, c DiffConfigProvider, diffOpts *state.DiffOpts) (*string, map[string]state.ReleaseSpec, map[string]state.ReleaseSpec, []error) { | ||||||
| 	st := r.state | 	st := r.state | ||||||
| 	helm := r.helm | 	helm := r.helm | ||||||
|  |  | ||||||
|  | @ -8,7 +8,6 @@ import ( | ||||||
| 	"github.com/google/go-cmp/cmp" | 	"github.com/google/go-cmp/cmp" | ||||||
| 
 | 
 | ||||||
| 	"github.com/helmfile/helmfile/pkg/environment" | 	"github.com/helmfile/helmfile/pkg/environment" | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/state" | 	"github.com/helmfile/helmfile/pkg/state" | ||||||
| 	"github.com/helmfile/helmfile/pkg/tmpl" | 	"github.com/helmfile/helmfile/pkg/tmpl" | ||||||
| ) | ) | ||||||
|  | @ -84,9 +83,6 @@ func (r *desiredStateLoader) renderTemplatesToYamlWithEnv(baseDir, filename stri | ||||||
| func (r *desiredStateLoader) twoPassRenderTemplateToYaml(inherited, overrode *environment.Environment, baseDir, filename string, content []byte) (*bytes.Buffer, error) { | func (r *desiredStateLoader) twoPassRenderTemplateToYaml(inherited, overrode *environment.Environment, baseDir, filename string, content []byte) (*bytes.Buffer, error) { | ||||||
| 	// try a first pass render. This will always succeed, but can produce a limited env
 | 	// try a first pass render. This will always succeed, but can produce a limited env
 | ||||||
| 	var phase string | 	var phase string | ||||||
| 	if !runtime.V1Mode { |  | ||||||
| 		phase = "first-pass " |  | ||||||
| 	} |  | ||||||
| 	r.logger.Debugf("%srendering starting for \"%s\": inherited=%v, overrode=%v", phase, filename, inherited, overrode) | 	r.logger.Debugf("%srendering starting for \"%s\": inherited=%v, overrode=%v", phase, filename, inherited, overrode) | ||||||
| 
 | 
 | ||||||
| 	initEnv, err := inherited.Merge(nil) | 	initEnv, err := inherited.Merge(nil) | ||||||
|  | @ -100,53 +96,14 @@ func (r *desiredStateLoader) twoPassRenderTemplateToYaml(inherited, overrode *en | ||||||
| 		vals           map[string]any | 		vals           map[string]any | ||||||
| 	) | 	) | ||||||
| 
 | 
 | ||||||
| 	if runtime.V1Mode { | 	finalEnv, err = initEnv.Merge(overrode) | ||||||
| 		var err error | 	if err != nil { | ||||||
|  | 		return nil, err | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 		finalEnv, err = initEnv.Merge(overrode) | 	vals, err = finalEnv.GetMergedValues() | ||||||
| 		if err != nil { | 	if err != nil { | ||||||
| 			return nil, err | 		return nil, err | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		vals, err = finalEnv.GetMergedValues() |  | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 	} else { |  | ||||||
| 		r.logger.Debugf("first-pass uses: %v", initEnv) |  | ||||||
| 		firstPassEnv, err := initEnv.Merge(nil) |  | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 		renderedEnv, prestate := r.renderPrestate(firstPassEnv, overrode, baseDir, filename, content) |  | ||||||
| 
 |  | ||||||
| 		r.logger.Debugf("first-pass produced: %v", renderedEnv) |  | ||||||
| 
 |  | ||||||
| 		mergedEnv, err := inherited.Merge(renderedEnv) |  | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		mergedEnv, err = mergedEnv.Merge(overrode) |  | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		r.logger.Debugf("first-pass rendering result of \"%s\": %v", filename, *mergedEnv) |  | ||||||
| 
 |  | ||||||
| 		renderingPhase = "second-pass " |  | ||||||
| 
 |  | ||||||
| 		finalEnv = mergedEnv |  | ||||||
| 
 |  | ||||||
| 		vals, err = finalEnv.GetMergedValues() |  | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if prestate != nil { |  | ||||||
| 			prestate.Env = *mergedEnv |  | ||||||
| 			r.logger.Debugf("vals:\n%v\ndefaultVals:%v", vals, prestate.DefaultValues) |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	tmplData := state.NewEnvironmentTemplateData(*finalEnv, r.namespace, vals) | 	tmplData := state.NewEnvironmentTemplateData(*finalEnv, r.namespace, vals) | ||||||
|  |  | ||||||
|  | @ -7,7 +7,6 @@ import ( | ||||||
| 
 | 
 | ||||||
| 	"github.com/helmfile/helmfile/pkg/helmexec" | 	"github.com/helmfile/helmfile/pkg/helmexec" | ||||||
| 	"github.com/helmfile/helmfile/pkg/remote" | 	"github.com/helmfile/helmfile/pkg/remote" | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/state" | 	"github.com/helmfile/helmfile/pkg/state" | ||||||
| 	"github.com/helmfile/helmfile/pkg/testhelper" | 	"github.com/helmfile/helmfile/pkg/testhelper" | ||||||
| 	"github.com/helmfile/helmfile/pkg/yaml" | 	"github.com/helmfile/helmfile/pkg/yaml" | ||||||
|  | @ -165,20 +164,7 @@ releases: | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestReadFromYaml_RenderTemplateLog(t *testing.T) { | func TestReadFromYaml_RenderTemplateLog(t *testing.T) { | ||||||
| 	v := runtime.V1Mode | 	testReadFromYaml_RenderTemplateLog(t) | ||||||
| 	t.Cleanup(func() { |  | ||||||
| 		runtime.V1Mode = v |  | ||||||
| 	}) |  | ||||||
| 
 |  | ||||||
| 	t.Run("v0mode", func(t *testing.T) { |  | ||||||
| 		runtime.V1Mode = false |  | ||||||
| 		testReadFromYaml_RenderTemplateLog(t) |  | ||||||
| 	}) |  | ||||||
| 
 |  | ||||||
| 	t.Run("v1mode", func(t *testing.T) { |  | ||||||
| 		runtime.V1Mode = true |  | ||||||
| 		testReadFromYaml_RenderTemplateLog(t) |  | ||||||
| 	}) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestReadFromYaml_RenderTemplateWithValuesReferenceError(t *testing.T) { | func TestReadFromYaml_RenderTemplateWithValuesReferenceError(t *testing.T) { | ||||||
|  |  | ||||||
|  | @ -18,10 +18,6 @@ type ApplyOptions struct { | ||||||
| 	DetailedExitcode bool | 	DetailedExitcode bool | ||||||
| 	// StripTrailingCR is true if trailing carriage returns should be stripped during diffing
 | 	// StripTrailingCR is true if trailing carriage returns should be stripped during diffing
 | ||||||
| 	StripTrailingCR bool | 	StripTrailingCR bool | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	// DEPRECATED: Use skip-cleanup instead
 |  | ||||||
| 	RetainValuesFiles bool |  | ||||||
| 
 |  | ||||||
| 	// SkipCleanup is true if the cleanup of temporary values files should be skipped
 | 	// SkipCleanup is true if the cleanup of temporary values files should be skipped
 | ||||||
| 	SkipCleanup bool | 	SkipCleanup bool | ||||||
| 	// SkipCRDs is true if the CRDs should be skipped
 | 	// SkipCRDs is true if the CRDs should be skipped
 | ||||||
|  | @ -139,12 +135,6 @@ func (a *ApplyImpl) IncludeTransitiveNeeds() bool { | ||||||
| 	return a.ApplyOptions.IncludeTransitiveNeeds | 	return a.ApplyOptions.IncludeTransitiveNeeds | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| // RetainValuesFiles returns the retain values files.
 |  | ||||||
| func (a *ApplyImpl) RetainValuesFiles() bool { |  | ||||||
| 	return a.ApplyOptions.RetainValuesFiles |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // ShowSecrets returns the show secrets.
 | // ShowSecrets returns the show secrets.
 | ||||||
| func (a *ApplyImpl) ShowSecrets() bool { | func (a *ApplyImpl) ShowSecrets() bool { | ||||||
| 	return a.ApplyOptions.ShowSecrets | 	return a.ApplyOptions.ShowSecrets | ||||||
|  |  | ||||||
|  | @ -1,46 +0,0 @@ | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| package config |  | ||||||
| 
 |  | ||||||
| // ChartsOptions is the options for the build command
 |  | ||||||
| type ChartsOptions struct { |  | ||||||
| 	// Set is the additional values to be merged into the helm command --set flag
 |  | ||||||
| 	Set []string |  | ||||||
| 	// Values is the additional value files to be merged into the helm command --values flag
 |  | ||||||
| 	Values []string |  | ||||||
| 	// Concurrency is the maximum number of concurrent helm processes to run, 0 is unlimited
 |  | ||||||
| 	Concurrency int |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // NewChartsOptions creates a new Apply
 |  | ||||||
| func NewChartsOptions() *ChartsOptions { |  | ||||||
| 	return &ChartsOptions{} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // ChartsImpl is impl for applyOptions
 |  | ||||||
| type ChartsImpl struct { |  | ||||||
| 	*GlobalImpl |  | ||||||
| 	*ChartsOptions |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // NewChartsImpl creates a new ChartsImpl
 |  | ||||||
| func NewChartsImpl(g *GlobalImpl, b *ChartsOptions) *ChartsImpl { |  | ||||||
| 	return &ChartsImpl{ |  | ||||||
| 		GlobalImpl:    g, |  | ||||||
| 		ChartsOptions: b, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Concurrency returns the concurrency
 |  | ||||||
| func (c *ChartsImpl) Concurrency() int { |  | ||||||
| 	return c.ChartsOptions.Concurrency |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // IncludeTransitiveNeeds returns the includeTransitiveNeeds
 |  | ||||||
| func (c *ChartsImpl) IncludeTransitiveNeeds() bool { |  | ||||||
| 	return false |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Values returns the values
 |  | ||||||
| func (c *ChartsImpl) Values() []string { |  | ||||||
| 	return c.ChartsOptions.Values |  | ||||||
| } |  | ||||||
|  | @ -1,67 +0,0 @@ | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| package config |  | ||||||
| 
 |  | ||||||
| // DeleteOptions is the options for the build command
 |  | ||||||
| type DeleteOptions struct { |  | ||||||
| 	// Concurrency is the maximum number of concurrent helm processes to run, 0 is unlimited
 |  | ||||||
| 	Concurrency int |  | ||||||
| 	// Purge is the purge flag
 |  | ||||||
| 	Purge bool |  | ||||||
| 	// SkipCharts makes Delete skip `withPreparedCharts`
 |  | ||||||
| 	SkipCharts bool |  | ||||||
| 	// Cascade '--cascade' to helmv3 delete, available values: background, foreground, or orphan, default: background
 |  | ||||||
| 	Cascade string |  | ||||||
| 	// Wait '--wait' if set, will wait until all the resources are deleted before returning. It will wait for as long as --timeout
 |  | ||||||
| 	DeleteWait bool |  | ||||||
| 	// Timeout '--timeout', to wait for helm delete operation (default 5m0s)
 |  | ||||||
| 	DeleteTimeout int |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // NewDeleteOptions creates a new Apply
 |  | ||||||
| func NewDeleteOptions() *DeleteOptions { |  | ||||||
| 	return &DeleteOptions{} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // DeleteImpl is impl for applyOptions
 |  | ||||||
| type DeleteImpl struct { |  | ||||||
| 	*GlobalImpl |  | ||||||
| 	*DeleteOptions |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // NewDeleteImpl creates a new DeleteImpl
 |  | ||||||
| func NewDeleteImpl(g *GlobalImpl, b *DeleteOptions) *DeleteImpl { |  | ||||||
| 	return &DeleteImpl{ |  | ||||||
| 		GlobalImpl:    g, |  | ||||||
| 		DeleteOptions: b, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Concurrency returns the concurrency
 |  | ||||||
| func (c *DeleteImpl) Concurrency() int { |  | ||||||
| 	return c.DeleteOptions.Concurrency |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Purge returns the purge
 |  | ||||||
| func (c *DeleteImpl) Purge() bool { |  | ||||||
| 	return c.DeleteOptions.Purge |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // SkipCharts returns skipCharts flag
 |  | ||||||
| func (c *DeleteImpl) SkipCharts() bool { |  | ||||||
| 	return c.DeleteOptions.SkipCharts |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Cascade returns cascade flag
 |  | ||||||
| func (c *DeleteImpl) Cascade() string { |  | ||||||
| 	return c.DeleteOptions.Cascade |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // DeleteWait returns the wait flag
 |  | ||||||
| func (c *DeleteImpl) DeleteWait() bool { |  | ||||||
| 	return c.DeleteOptions.DeleteWait |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // DeleteTimeout returns the timeout flag
 |  | ||||||
| func (c *DeleteImpl) DeleteTimeout() int { |  | ||||||
| 	return c.DeleteOptions.DeleteTimeout |  | ||||||
| } |  | ||||||
|  | @ -6,16 +6,12 @@ const ( | ||||||
| 	// use helm status to check if a release exists before installing it
 | 	// use helm status to check if a release exists before installing it
 | ||||||
| 	UseHelmStatusToCheckReleaseExistence = "HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE" | 	UseHelmStatusToCheckReleaseExistence = "HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE" | ||||||
| 
 | 
 | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	SkipInsecureTemplateFunctions = "HELMFILE_SKIP_INSECURE_TEMPLATE_FUNCTIONS" |  | ||||||
| 
 |  | ||||||
| 	DisableRunnerUniqueID = "HELMFILE_DISABLE_RUNNER_UNIQUE_ID" | 	DisableRunnerUniqueID = "HELMFILE_DISABLE_RUNNER_UNIQUE_ID" | ||||||
| 	Experimental          = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case
 | 	Experimental          = "HELMFILE_EXPERIMENTAL" // environment variable for experimental features, expecting "true" lower case
 | ||||||
| 	Environment           = "HELMFILE_ENVIRONMENT" | 	Environment           = "HELMFILE_ENVIRONMENT" | ||||||
| 	FilePath              = "HELMFILE_FILE_PATH" | 	FilePath              = "HELMFILE_FILE_PATH" | ||||||
| 	TempDir               = "HELMFILE_TEMPDIR" | 	TempDir               = "HELMFILE_TEMPDIR" | ||||||
| 	UpgradeNoticeDisabled = "HELMFILE_UPGRADE_NOTICE_DISABLED" | 	UpgradeNoticeDisabled = "HELMFILE_UPGRADE_NOTICE_DISABLED" | ||||||
| 	V1Mode                = "HELMFILE_V1MODE" |  | ||||||
| 	GoccyGoYaml           = "HELMFILE_GOCCY_GOYAML" | 	GoccyGoYaml           = "HELMFILE_GOCCY_GOYAML" | ||||||
| 	CacheHome             = "HELMFILE_CACHE_HOME" | 	CacheHome             = "HELMFILE_CACHE_HOME" | ||||||
| 	Interactive           = "HELMFILE_INTERACTIVE" | 	Interactive           = "HELMFILE_INTERACTIVE" | ||||||
|  |  | ||||||
|  | @ -9,8 +9,6 @@ import ( | ||||||
| 	"slices" | 	"slices" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"unicode" | 	"unicode" | ||||||
| 
 |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
|  | @ -51,7 +49,7 @@ func forbidEnvironmentsWithReleases(filePath string, content []byte) (bool, erro | ||||||
| 	} | 	} | ||||||
| 	for i := 0; i < len(result)-1; i++ { | 	for i := 0; i < len(result)-1; i++ { | ||||||
| 		if result[i] != "---" && result[i+1] != "---" { | 		if result[i] != "---" && result[i+1] != "---" { | ||||||
| 			return runtime.V1Mode, EnvironmentsAndReleasesWithinSameYamlPartErr | 			return true, EnvironmentsAndReleasesWithinSameYamlPartErr | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return false, nil | 	return false, nil | ||||||
|  | @ -123,7 +121,7 @@ func TopConfigKeysVerifier(filePath string, helmfileContent []byte) (bool, error | ||||||
| 		preKey := orderKeys[i-1] | 		preKey := orderKeys[i-1] | ||||||
| 		currentKey := orderKeys[i] | 		currentKey := orderKeys[i] | ||||||
| 		if topkeysPriority[preKey] > topkeysPriority[currentKey] { | 		if topkeysPriority[preKey] > topkeysPriority[currentKey] { | ||||||
| 			return runtime.V1Mode, fmt.Errorf("top-level config key %s must be defined before %s in %s", currentKey, preKey, filePath) | 			return true, fmt.Errorf("top-level config key %s must be defined before %s in %s", currentKey, preKey, filePath) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	return false, nil | 	return false, nil | ||||||
|  |  | ||||||
|  | @ -4,15 +4,12 @@ import ( | ||||||
| 	"testing" | 	"testing" | ||||||
| 
 | 
 | ||||||
| 	"github.com/stretchr/testify/require" | 	"github.com/stretchr/testify/require" | ||||||
| 
 |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func TestForbidEnvironmentsWithReleases(t *testing.T) { | func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 	testCases := []struct { | 	testCases := []struct { | ||||||
| 		name        string | 		name        string | ||||||
| 		filePath    string | 		filePath    string | ||||||
| 		v1mode      bool |  | ||||||
| 		content     []byte | 		content     []byte | ||||||
| 		expectedErr bool | 		expectedErr bool | ||||||
| 		isStrict    bool | 		isStrict    bool | ||||||
|  | @ -21,7 +18,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 			name:        "no error when only releases", | 			name:        "no error when only releases", | ||||||
| 			filePath:    "helmfile.yaml", | 			filePath:    "helmfile.yaml", | ||||||
| 			content:     []byte("releases:\n"), | 			content:     []byte("releases:\n"), | ||||||
| 			v1mode:      false, |  | ||||||
| 			expectedErr: false, | 			expectedErr: false, | ||||||
| 			isStrict:    false, | 			isStrict:    false, | ||||||
| 		}, | 		}, | ||||||
|  | @ -29,7 +25,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 			name:        "no error when only environments", | 			name:        "no error when only environments", | ||||||
| 			filePath:    "helmfile.yaml", | 			filePath:    "helmfile.yaml", | ||||||
| 			content:     []byte("environments:\n"), | 			content:     []byte("environments:\n"), | ||||||
| 			v1mode:      false, |  | ||||||
| 			expectedErr: false, | 			expectedErr: false, | ||||||
| 			isStrict:    false, | 			isStrict:    false, | ||||||
| 		}, | 		}, | ||||||
|  | @ -37,7 +32,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 			name:        "no error when has --- between releases and environments", | 			name:        "no error when has --- between releases and environments", | ||||||
| 			filePath:    "helmfile.yaml", | 			filePath:    "helmfile.yaml", | ||||||
| 			content:     []byte("environments:\n---\nreleases:\n"), | 			content:     []byte("environments:\n---\nreleases:\n"), | ||||||
| 			v1mode:      false, |  | ||||||
| 			expectedErr: false, | 			expectedErr: false, | ||||||
| 			isStrict:    false, | 			isStrict:    false, | ||||||
| 		}, | 		}, | ||||||
|  | @ -45,7 +39,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 			name:        "no error when has --- between releases and environments, and --- on top of helmfile.yaml.gotmpl", | 			name:        "no error when has --- between releases and environments, and --- on top of helmfile.yaml.gotmpl", | ||||||
| 			filePath:    "helmfile.yaml", | 			filePath:    "helmfile.yaml", | ||||||
| 			content:     []byte("---\nenvironments:\n---\nreleases:\n"), | 			content:     []byte("---\nenvironments:\n---\nreleases:\n"), | ||||||
| 			v1mode:      false, |  | ||||||
| 			expectedErr: false, | 			expectedErr: false, | ||||||
| 			isStrict:    false, | 			isStrict:    false, | ||||||
| 		}, | 		}, | ||||||
|  | @ -53,7 +46,6 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 			name:        "error when both releases and environments", | 			name:        "error when both releases and environments", | ||||||
| 			filePath:    "helmfile.yaml", | 			filePath:    "helmfile.yaml", | ||||||
| 			content:     []byte("environments:\nreleases:\n"), | 			content:     []byte("environments:\nreleases:\n"), | ||||||
| 			v1mode:      false, |  | ||||||
| 			expectedErr: true, | 			expectedErr: true, | ||||||
| 			isStrict:    false, | 			isStrict:    false, | ||||||
| 		}, | 		}, | ||||||
|  | @ -61,20 +53,13 @@ func TestForbidEnvironmentsWithReleases(t *testing.T) { | ||||||
| 			name:        "error when both releases and environments for plain yaml on v1", | 			name:        "error when both releases and environments for plain yaml on v1", | ||||||
| 			filePath:    "helmfile.yaml", | 			filePath:    "helmfile.yaml", | ||||||
| 			content:     []byte("environments:\nreleases:\n"), | 			content:     []byte("environments:\nreleases:\n"), | ||||||
| 			v1mode:      true, |  | ||||||
| 			expectedErr: true, | 			expectedErr: true, | ||||||
| 			isStrict:    true, | 			isStrict:    true, | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	v1mode := runtime.V1Mode |  | ||||||
| 	t.Cleanup(func() { |  | ||||||
| 		runtime.V1Mode = v1mode |  | ||||||
| 	}) |  | ||||||
| 
 |  | ||||||
| 	for _, tc := range testCases { | 	for _, tc := range testCases { | ||||||
| 		t.Run(tc.name, func(t *testing.T) { | 		t.Run(tc.name, func(t *testing.T) { | ||||||
| 			runtime.V1Mode = tc.v1mode |  | ||||||
| 			isStrict, err := forbidEnvironmentsWithReleases(tc.filePath, tc.content) | 			isStrict, err := forbidEnvironmentsWithReleases(tc.filePath, tc.content) | ||||||
| 			require.Equal(t, tc.isStrict, isStrict, "expected isStrict=%v, got=%v", tc.isStrict, isStrict) | 			require.Equal(t, tc.isStrict, isStrict, "expected isStrict=%v, got=%v", tc.isStrict, isStrict) | ||||||
| 			if tc.expectedErr { | 			if tc.expectedErr { | ||||||
|  |  | ||||||
|  | @ -3,24 +3,15 @@ package runtime | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
| 	"strconv" |  | ||||||
| 
 | 
 | ||||||
| 	"github.com/helmfile/helmfile/pkg/envvar" | 	"github.com/helmfile/helmfile/pkg/envvar" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // V1Mode is false by default for Helmfile v0.x and
 |  | ||||||
| // true by default for Helmfile v1.x
 |  | ||||||
| var ( | var ( | ||||||
| 	V1Mode bool |  | ||||||
| 
 |  | ||||||
| 	// GoccyGoYaml is set to true in order to let Helmfile use
 | 	// GoccyGoYaml is set to true in order to let Helmfile use
 | ||||||
| 	// goccy/go-yaml instead of gopkg.in/yaml.v2.
 | 	// goccy/go-yaml instead of gopkg.in/yaml.v2.
 | ||||||
| 	// It's false by default in Helmfile v0.x and true by default for Helmfile v1.x.
 | 	// It's false by default in Helmfile v0.x and true by default for Helmfile v1.x.
 | ||||||
| 	GoccyGoYaml bool | 	GoccyGoYaml bool | ||||||
| 
 |  | ||||||
| 	// We set this via ldflags at build-time so that we can use the
 |  | ||||||
| 	// value specified at the build time as the runtime default.
 |  | ||||||
| 	v1Mode string |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func Info() string { | func Info() string { | ||||||
|  | @ -29,22 +20,10 @@ func Info() string { | ||||||
| 		yamlLib = "goccy/go-yaml" | 		yamlLib = "goccy/go-yaml" | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return fmt.Sprintf("V1 mode = %v\nYAML library = %v", V1Mode, yamlLib) | 	return fmt.Sprintf("YAML library = %v", yamlLib) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| 	// You can toggle the V1 mode at runtime via an envvar:
 |  | ||||||
| 	// - Helmfile v1.x behaves like v0.x by running it with HELMFILE_V1MODE=false
 |  | ||||||
| 	// - Helmfile v0.x behaves like v1.x by with HELMFILE_V1MODE=true
 |  | ||||||
| 	switch os.Getenv(envvar.V1Mode) { |  | ||||||
| 	case "true": |  | ||||||
| 		V1Mode = true |  | ||||||
| 	case "false": |  | ||||||
| 		V1Mode = false |  | ||||||
| 	default: |  | ||||||
| 		V1Mode, _ = strconv.ParseBool(v1Mode) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// You can switch the YAML library at runtime via an envvar:
 | 	// You can switch the YAML library at runtime via an envvar:
 | ||||||
| 	switch os.Getenv(envvar.GoccyGoYaml) { | 	switch os.Getenv(envvar.GoccyGoYaml) { | ||||||
| 	case "true": | 	case "true": | ||||||
|  | @ -52,6 +31,6 @@ func init() { | ||||||
| 	case "false": | 	case "false": | ||||||
| 		GoccyGoYaml = false | 		GoccyGoYaml = false | ||||||
| 	default: | 	default: | ||||||
| 		GoccyGoYaml = V1Mode | 		GoccyGoYaml = true | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -117,20 +117,6 @@ func (c *StateCreator) Parse(content []byte, baseDir, file string) (*HelmState, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	if len(state.DeprecatedReleases) > 0 { |  | ||||||
| 		if len(state.Releases) > 0 { |  | ||||||
| 			return nil, fmt.Errorf("failed to parse %s: you can't specify both `charts` and `releases` sections", file) |  | ||||||
| 		} |  | ||||||
| 		state.Releases = state.DeprecatedReleases |  | ||||||
| 		state.DeprecatedReleases = []ReleaseSpec{} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	if state.DeprecatedContext != "" && state.HelmDefaults.KubeContext == "" { |  | ||||||
| 		state.HelmDefaults.KubeContext = state.DeprecatedContext |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if c.overrideHelmBinary != "" && c.overrideHelmBinary != DefaultHelmBinary { | 	if c.overrideHelmBinary != "" && c.overrideHelmBinary != DefaultHelmBinary { | ||||||
| 		state.DefaultHelmBinary = c.overrideHelmBinary | 		state.DefaultHelmBinary = c.overrideHelmBinary | ||||||
| 	} else if state.DefaultHelmBinary == "" { | 	} else if state.DefaultHelmBinary == "" { | ||||||
|  |  | ||||||
|  | @ -280,26 +280,6 @@ func TestReadFromYaml_StrictUnmarshalling(t *testing.T) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| func TestReadFromYaml_DeprecatedReleaseReferences(t *testing.T) { |  | ||||||
| 	yamlFile := "example/path/to/yaml/file" |  | ||||||
| 	yamlContent := []byte(`charts: |  | ||||||
| - name: myrelease |  | ||||||
|   chart: mychart |  | ||||||
| `) |  | ||||||
| 	state, err := createFromYaml(yamlContent, yamlFile, DefaultEnv, logger) |  | ||||||
| 	if err != nil { |  | ||||||
| 		t.Errorf("unxpected error: %v", err) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if state.Releases[0].Name != "myrelease" { |  | ||||||
| 		t.Errorf("unexpected release name: expected=myrelease actual=%s", state.Releases[0].Name) |  | ||||||
| 	} |  | ||||||
| 	if state.Releases[0].Chart != "mychart" { |  | ||||||
| 		t.Errorf("unexpected chart name: expected=mychart actual=%s", state.Releases[0].Chart) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func TestReadFromYaml_ConflictingReleasesConfig(t *testing.T) { | func TestReadFromYaml_ConflictingReleasesConfig(t *testing.T) { | ||||||
| 	yamlFile := "example/path/to/yaml/file" | 	yamlFile := "example/path/to/yaml/file" | ||||||
| 	yamlContent := []byte(`charts: | 	yamlContent := []byte(`charts: | ||||||
|  |  | ||||||
|  | @ -60,10 +60,6 @@ type ReleaseSetSpec struct { | ||||||
| 	HelmDefaults HelmSpec          `yaml:"helmDefaults,omitempty"` | 	HelmDefaults HelmSpec          `yaml:"helmDefaults,omitempty"` | ||||||
| 	Helmfiles    []SubHelmfileSpec `yaml:"helmfiles,omitempty"` | 	Helmfiles    []SubHelmfileSpec `yaml:"helmfiles,omitempty"` | ||||||
| 
 | 
 | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	DeprecatedContext  string        `yaml:"context,omitempty"` |  | ||||||
| 	DeprecatedReleases []ReleaseSpec `yaml:"charts,omitempty"` |  | ||||||
| 
 |  | ||||||
| 	OverrideKubeContext string            `yaml:"kubeContext,omitempty"` | 	OverrideKubeContext string            `yaml:"kubeContext,omitempty"` | ||||||
| 	OverrideNamespace   string            `yaml:"namespace,omitempty"` | 	OverrideNamespace   string            `yaml:"namespace,omitempty"` | ||||||
| 	OverrideChart       string            `yaml:"chart,omitempty"` | 	OverrideChart       string            `yaml:"chart,omitempty"` | ||||||
|  |  | ||||||
|  | @ -58,13 +58,9 @@ func TestHelmState_applyDefaultsTo(t *testing.T) { | ||||||
| 	type fields struct { | 	type fields struct { | ||||||
| 		BaseChartPath string | 		BaseChartPath string | ||||||
| 		Context       string | 		Context       string | ||||||
| 
 | 		Namespace     string | ||||||
| 		// TODO: Remove this function once Helmfile v0.x
 | 		Repositories  []RepositorySpec | ||||||
| 		DeprecatedReleases []ReleaseSpec | 		Releases      []ReleaseSpec | ||||||
| 
 |  | ||||||
| 		Namespace    string |  | ||||||
| 		Repositories []RepositorySpec |  | ||||||
| 		Releases     []ReleaseSpec |  | ||||||
| 	} | 	} | ||||||
| 	type args struct { | 	type args struct { | ||||||
| 		spec ReleaseSpec | 		spec ReleaseSpec | ||||||
|  | @ -89,12 +85,8 @@ func TestHelmState_applyDefaultsTo(t *testing.T) { | ||||||
| 	fieldsWithNamespace := fields{ | 	fieldsWithNamespace := fields{ | ||||||
| 		BaseChartPath: ".", | 		BaseChartPath: ".", | ||||||
| 		Context:       "test_context", | 		Context:       "test_context", | ||||||
| 
 | 		Namespace:     specWithNamespaceFromFields.Namespace, | ||||||
| 		// TODO: Remove this function once Helmfile v0.x
 | 		Repositories:  nil, | ||||||
| 		DeprecatedReleases: nil, |  | ||||||
| 
 |  | ||||||
| 		Namespace:    specWithNamespaceFromFields.Namespace, |  | ||||||
| 		Repositories: nil, |  | ||||||
| 		Releases: []ReleaseSpec{ | 		Releases: []ReleaseSpec{ | ||||||
| 			specWithNamespace, | 			specWithNamespace, | ||||||
| 		}, | 		}, | ||||||
|  | @ -148,10 +140,6 @@ func TestHelmState_applyDefaultsTo(t *testing.T) { | ||||||
| 			state := &HelmState{ | 			state := &HelmState{ | ||||||
| 				basePath: tt.fields.BaseChartPath, | 				basePath: tt.fields.BaseChartPath, | ||||||
| 				ReleaseSetSpec: ReleaseSetSpec{ | 				ReleaseSetSpec: ReleaseSetSpec{ | ||||||
| 					// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 					DeprecatedContext:  tt.fields.Context, |  | ||||||
| 					DeprecatedReleases: tt.fields.DeprecatedReleases, |  | ||||||
| 
 |  | ||||||
| 					OverrideNamespace: tt.fields.Namespace, | 					OverrideNamespace: tt.fields.Namespace, | ||||||
| 					Repositories:      tt.fields.Repositories, | 					Repositories:      tt.fields.Repositories, | ||||||
| 					Releases:          tt.fields.Releases, | 					Releases:          tt.fields.Releases, | ||||||
|  | @ -740,9 +728,6 @@ func TestHelmState_flagsForUpgrade(t *testing.T) { | ||||||
| 			state := &HelmState{ | 			state := &HelmState{ | ||||||
| 				basePath: "./", | 				basePath: "./", | ||||||
| 				ReleaseSetSpec: ReleaseSetSpec{ | 				ReleaseSetSpec: ReleaseSetSpec{ | ||||||
| 					// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 					DeprecatedContext: "default", |  | ||||||
| 
 |  | ||||||
| 					Releases:     []ReleaseSpec{*tt.release}, | 					Releases:     []ReleaseSpec{*tt.release}, | ||||||
| 					HelmDefaults: tt.defaults, | 					HelmDefaults: tt.defaults, | ||||||
| 				}, | 				}, | ||||||
|  | @ -904,9 +889,8 @@ func TestHelmState_flagsForTemplate(t *testing.T) { | ||||||
| 			state := &HelmState{ | 			state := &HelmState{ | ||||||
| 				basePath: "./", | 				basePath: "./", | ||||||
| 				ReleaseSetSpec: ReleaseSetSpec{ | 				ReleaseSetSpec: ReleaseSetSpec{ | ||||||
| 					DeprecatedContext: "default", | 					Releases:     []ReleaseSpec{*tt.release}, | ||||||
| 					Releases:          []ReleaseSpec{*tt.release}, | 					HelmDefaults: tt.defaults, | ||||||
| 					HelmDefaults:      tt.defaults, |  | ||||||
| 				}, | 				}, | ||||||
| 				valsRuntime: valsRuntime, | 				valsRuntime: valsRuntime, | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|  | @ -19,7 +19,6 @@ import ( | ||||||
| 	"github.com/helmfile/helmfile/pkg/envvar" | 	"github.com/helmfile/helmfile/pkg/envvar" | ||||||
| 	"github.com/helmfile/helmfile/pkg/helmexec" | 	"github.com/helmfile/helmfile/pkg/helmexec" | ||||||
| 	"github.com/helmfile/helmfile/pkg/maputil" | 	"github.com/helmfile/helmfile/pkg/maputil" | ||||||
| 	"github.com/helmfile/helmfile/pkg/runtime" |  | ||||||
| 	"github.com/helmfile/helmfile/pkg/yaml" | 	"github.com/helmfile/helmfile/pkg/yaml" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | @ -37,23 +36,10 @@ func (e DisableInsecureFeaturesError) Error() string { | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
| 	disableInsecureFeatures bool | 	disableInsecureFeatures bool | ||||||
| 
 |  | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	skipInsecureTemplateFunctions bool |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| 	disableInsecureFeatures, _ = strconv.ParseBool(os.Getenv(envvar.DisableInsecureFeatures)) | 	disableInsecureFeatures, _ = strconv.ParseBool(os.Getenv(envvar.DisableInsecureFeatures)) | ||||||
| 
 |  | ||||||
| 	// TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| 	skipInsecureTemplateFunctions, _ = strconv.ParseBool(os.Getenv(envvar.SkipInsecureTemplateFunctions)) |  | ||||||
| 	skipInsecureTemplateFunctions = func() bool { |  | ||||||
| 		if runtime.V1Mode { |  | ||||||
| 			return false |  | ||||||
| 		} |  | ||||||
| 		b, _ := strconv.ParseBool(os.Getenv(envvar.SkipInsecureTemplateFunctions)) |  | ||||||
| 		return b |  | ||||||
| 	}() |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (c *Context) createFuncMap() template.FuncMap { | func (c *Context) createFuncMap() template.FuncMap { | ||||||
|  | @ -76,7 +62,7 @@ func (c *Context) createFuncMap() template.FuncMap { | ||||||
| 		"fetchSecretValue": fetchSecretValue, | 		"fetchSecretValue": fetchSecretValue, | ||||||
| 		"expandSecretRefs": fetchSecretValues, | 		"expandSecretRefs": fetchSecretValues, | ||||||
| 	} | 	} | ||||||
| 	if c.preRender || skipInsecureTemplateFunctions { | 	if c.preRender { | ||||||
| 		// disable potential side-effect template calls
 | 		// disable potential side-effect template calls
 | ||||||
| 		funcMap["exec"] = func(string, []any, ...string) (string, error) { | 		funcMap["exec"] = func(string, []any, ...string) (string, error) { | ||||||
| 			return "", nil | 			return "", nil | ||||||
|  |  | ||||||
|  | @ -46,30 +46,6 @@ func TestCreateFuncMap_DisabledInsecureFeatures(t *testing.T) { | ||||||
| 	disableInsecureFeatures = currentVal | 	disableInsecureFeatures = currentVal | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // TODO: Remove this function once Helmfile v0.x
 |  | ||||||
| func TestCreateFuncMap_SkipInsecureTemplateFunctions(t *testing.T) { |  | ||||||
| 	if runtime.V1Mode { |  | ||||||
| 		t.Logf("SkipInsecureTemplateFunctions is not supported in V1 mode") |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| 	currentVal := skipInsecureTemplateFunctions |  | ||||||
| 
 |  | ||||||
| 	{ |  | ||||||
| 		skipInsecureTemplateFunctions = true |  | ||||||
| 		ctx := &Context{basePath: "."} |  | ||||||
| 		funcMaps := ctx.createFuncMap() |  | ||||||
| 		args := make([]any, 0) |  | ||||||
| 		actual1, err1 := funcMaps["exec"].(func(command string, args []any, inputs ...string) (string, error))("ls", args) |  | ||||||
| 		require.Equal(t, "", actual1) |  | ||||||
| 		require.ErrorIs(t, err1, nil) |  | ||||||
| 		actual2, err2 := funcMaps["readFile"].(func(filename string) (string, error))("context_funcs_test.go") |  | ||||||
| 		require.Equal(t, "", actual2) |  | ||||||
| 		require.ErrorIs(t, err2, nil) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	skipInsecureTemplateFunctions = currentVal |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| func newFSExpecting(expectedFilename string, expected string) *filesystem.FileSystem { | func newFSExpecting(expectedFilename string, expected string) *filesystem.FileSystem { | ||||||
| 	return filesystem.FromFileSystem(filesystem.FileSystem{ | 	return filesystem.FromFileSystem(filesystem.FileSystem{ | ||||||
| 		ReadFile: func(filename string) ([]byte, error) { | 		ReadFile: func(filename string) ([]byte, error) { | ||||||
|  |  | ||||||
|  | @ -1,14 +1,7 @@ | ||||||
| chart_need_case_input_dir="${cases_dir}/chart-needs/input" | chart_need_case_input_dir="${cases_dir}/chart-needs/input" | ||||||
| chart_need_case_output_dir="${cases_dir}/chart-needs/output" | chart_need_case_output_dir="${cases_dir}/chart-needs/output" | ||||||
| 
 | 
 | ||||||
| config_file="helmfile.yaml" | config_file="helmfile.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${chart_need_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| chart_needs_tmp=$(mktemp -d) | chart_needs_tmp=$(mktemp -d) | ||||||
| chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log | chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log | ||||||
| chart_needs_lint_reverse=${chart_needs_tmp}/chart.needs.lint.log | chart_needs_lint_reverse=${chart_needs_tmp}/chart.needs.lint.log | ||||||
|  |  | ||||||
|  | @ -1,14 +1,7 @@ | ||||||
| chartify_jsonPatches_and_strategicMergePatches_case_input_dir="${cases_dir}/chartify-jsonPatches-and-strategicMergePatches/input" | chartify_jsonPatches_and_strategicMergePatches_case_input_dir="${cases_dir}/chartify-jsonPatches-and-strategicMergePatches/input" | ||||||
| chartify_jsonPatches_and_strategicMergePatches_case_output_dir="${cases_dir}/chartify-jsonPatches-and-strategicMergePatches/output" | chartify_jsonPatches_and_strategicMergePatches_case_output_dir="${cases_dir}/chartify-jsonPatches-and-strategicMergePatches/output" | ||||||
| 
 | 
 | ||||||
| config_file="helmfile.yaml" | config_file="helmfile.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${chartify_jsonPatches_and_strategicMergePatches_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| chartify_jsonPatches_and_strategicMergePatches_tmp=$(mktemp -d) | chartify_jsonPatches_and_strategicMergePatches_tmp=$(mktemp -d) | ||||||
| chartify_jsonPatches_and_strategicMergePatches_template_reverse=${chartify_jsonPatches_and_strategicMergePatches_tmp}/chartify_jsonPatches_and_strategicMergePatches.template.log | chartify_jsonPatches_and_strategicMergePatches_template_reverse=${chartify_jsonPatches_and_strategicMergePatches_tmp}/chartify_jsonPatches_and_strategicMergePatches.template.log | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,14 +1,7 @@ | ||||||
| chartify_case_input_dir="${cases_dir}/chartify/input" | chartify_case_input_dir="${cases_dir}/chartify/input" | ||||||
| chartify_case_output_dir="${cases_dir}/chartify/output" | chartify_case_output_dir="${cases_dir}/chartify/output" | ||||||
| 
 | 
 | ||||||
| config_file="helmfile.yaml" | config_file="helmfile.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${chartify_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| chartify_tmp=$(mktemp -d) | chartify_tmp=$(mktemp -d) | ||||||
| chartify_template_reverse=${chartify_tmp}/chartify.template.log | chartify_template_reverse=${chartify_tmp}/chartify.template.log | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,24 +6,12 @@ cli_overwrite_environment_values_reverse=${cli_overwrite_environment_values_tmp} | ||||||
| 
 | 
 | ||||||
| case_title="cli overwrite environment values" | case_title="cli overwrite environment values" | ||||||
| 
 | 
 | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then | test_start "$case_title" | ||||||
|   test_start "$case_title for v1" | info "Comparing ${case_title} for output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml" | ||||||
|   info "Comparing ${case_title} for v1 output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml" | for i in $(seq 10); do | ||||||
|   for i in $(seq 10); do |     info "Comparing build/cli-overwrite-environment-values #$i" | ||||||
|       info "Comparing build/cli-overwrite-environment-values #$i" |     ${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input.yaml.gotmpl template --state-values-set ns=test3 --state-values-set-string imageTag=1.23.3,zone="zone1,zone2" > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail" | ||||||
|       ${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 --state-values-set-string imageTag=1.23.3,zone="zone1,zone2" > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail" |     diff -u ${cli_overwrite_environment_values_output_dir}/output.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent" | ||||||
|       diff -u ${cli_overwrite_environment_values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent" |     echo code=$? | ||||||
|       echo code=$? | done | ||||||
|   done | test_pass "cli overwrite environment values for v1" | ||||||
|   test_pass "cli overwrite environment values for v1" |  | ||||||
| else |  | ||||||
|   test_start "${case_title}"  |  | ||||||
|   info "Comparing ${case_title} output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml" |  | ||||||
|   for i in $(seq 10); do |  | ||||||
|       info "Comparing build/cli-overwrite-environment-values #$i" |  | ||||||
|       ${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 --state-values-set-string imageTag=1.23.3,zone="zone1,zone2" > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail" |  | ||||||
|       diff -u ${cli_overwrite_environment_values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent" |  | ||||||
|       echo code=$? |  | ||||||
|   done |  | ||||||
|   test_pass "${case_title}" |  | ||||||
| fi |  | ||||||
|  | @ -1,17 +0,0 @@ | ||||||
| environments: |  | ||||||
|   default: |  | ||||||
|     values: |  | ||||||
|       - base.yaml |  | ||||||
|       - override.yaml |  | ||||||
| 
 |  | ||||||
| repositories: |  | ||||||
|   - name: bitnami |  | ||||||
|     url: https://charts.bitnami.com/bitnami |  | ||||||
| 
 |  | ||||||
| releases: |  | ||||||
|   - name: test |  | ||||||
|     chart: bitnami/nginx |  | ||||||
|     namespace: {{ .Values.ns }} |  | ||||||
|     version: 13.2.27 |  | ||||||
|     values: |  | ||||||
|       - values.yaml.gotmpl |  | ||||||
|  | @ -1,9 +1,3 @@ | ||||||
| Warning: environments and releases cannot be defined within the same YAML part. Use --- to extract the environments into a dedicated part |  | ||||||
| Warning: environments and releases cannot be defined within the same YAML part. Use --- to extract the environments into a dedicated part |  | ||||||
| Adding repo bitnami https://charts.bitnami.com/bitnami |  | ||||||
| "bitnami" has been added to your repositories |  | ||||||
| 
 |  | ||||||
| Templating release=test, chart=bitnami/nginx |  | ||||||
| --- | --- | ||||||
| # Source: nginx/templates/svc.yaml | # Source: nginx/templates/svc.yaml | ||||||
| apiVersion: v1 | apiVersion: v1 | ||||||
|  | @ -57,6 +51,7 @@ spec: | ||||||
|         app.kubernetes.io/instance: test |         app.kubernetes.io/instance: test | ||||||
|         app.kubernetes.io/managed-by: Helm |         app.kubernetes.io/managed-by: Helm | ||||||
|       annotations: |       annotations: | ||||||
|  |         zone: "zone1,zone2" | ||||||
|     spec: |     spec: | ||||||
|        |        | ||||||
|       automountServiceAccountToken: false |       automountServiceAccountToken: false | ||||||
|  | @ -81,7 +76,7 @@ spec: | ||||||
|       initContainers: |       initContainers: | ||||||
|       containers: |       containers: | ||||||
|         - name: nginx |         - name: nginx | ||||||
|           image: docker.io/bitnami/nginx:test3 |           image: docker.io/bitnami/nginx:1.23.3 | ||||||
|           imagePullPolicy: "IfNotPresent" |           imagePullPolicy: "IfNotPresent" | ||||||
|           env: |           env: | ||||||
|             - name: BITNAMI_DEBUG |             - name: BITNAMI_DEBUG | ||||||
|  |  | ||||||
|  | @ -1,111 +0,0 @@ | ||||||
| --- |  | ||||||
| # Source: nginx/templates/svc.yaml |  | ||||||
| apiVersion: v1 |  | ||||||
| kind: Service |  | ||||||
| metadata: |  | ||||||
|   name: test-nginx |  | ||||||
|   namespace: "test3" |  | ||||||
|   labels: |  | ||||||
|     app.kubernetes.io/name: nginx |  | ||||||
|     helm.sh/chart: nginx-13.2.27 |  | ||||||
|     app.kubernetes.io/instance: test |  | ||||||
|     app.kubernetes.io/managed-by: Helm |  | ||||||
|   annotations: |  | ||||||
| spec: |  | ||||||
|   type: LoadBalancer |  | ||||||
|   sessionAffinity: None |  | ||||||
|   externalTrafficPolicy: "Cluster" |  | ||||||
|   ports: |  | ||||||
|     - name: http |  | ||||||
|       port: 80 |  | ||||||
|       targetPort: http |  | ||||||
|   selector: |  | ||||||
|     app.kubernetes.io/name: nginx |  | ||||||
|     app.kubernetes.io/instance: test |  | ||||||
| --- |  | ||||||
| # Source: nginx/templates/deployment.yaml |  | ||||||
| apiVersion: apps/v1 |  | ||||||
| kind: Deployment |  | ||||||
| metadata: |  | ||||||
|   name: test-nginx |  | ||||||
|   namespace: "test3" |  | ||||||
|   labels: |  | ||||||
|     app.kubernetes.io/name: nginx |  | ||||||
|     helm.sh/chart: nginx-13.2.27 |  | ||||||
|     app.kubernetes.io/instance: test |  | ||||||
|     app.kubernetes.io/managed-by: Helm |  | ||||||
| spec: |  | ||||||
|   replicas: 1 |  | ||||||
|   strategy: |  | ||||||
|     rollingUpdate: {} |  | ||||||
|     type: RollingUpdate |  | ||||||
|   selector: |  | ||||||
|     matchLabels: |  | ||||||
|       app.kubernetes.io/name: nginx |  | ||||||
|       app.kubernetes.io/instance: test |  | ||||||
|   template: |  | ||||||
|     metadata: |  | ||||||
|       labels: |  | ||||||
|         app.kubernetes.io/name: nginx |  | ||||||
|         helm.sh/chart: nginx-13.2.27 |  | ||||||
|         app.kubernetes.io/instance: test |  | ||||||
|         app.kubernetes.io/managed-by: Helm |  | ||||||
|       annotations: |  | ||||||
|         zone: "zone1,zone2" |  | ||||||
|     spec: |  | ||||||
|        |  | ||||||
|       automountServiceAccountToken: false |  | ||||||
|       shareProcessNamespace: false |  | ||||||
|       serviceAccountName: default |  | ||||||
|       affinity: |  | ||||||
|         podAffinity: |  | ||||||
|            |  | ||||||
|         podAntiAffinity: |  | ||||||
|           preferredDuringSchedulingIgnoredDuringExecution: |  | ||||||
|             - podAffinityTerm: |  | ||||||
|                 labelSelector: |  | ||||||
|                   matchLabels: |  | ||||||
|                     app.kubernetes.io/name: nginx |  | ||||||
|                     app.kubernetes.io/instance: test |  | ||||||
|                 topologyKey: kubernetes.io/hostname |  | ||||||
|               weight: 1 |  | ||||||
|         nodeAffinity: |  | ||||||
|            |  | ||||||
|       hostNetwork: false |  | ||||||
|       hostIPC: false |  | ||||||
|       initContainers: |  | ||||||
|       containers: |  | ||||||
|         - name: nginx |  | ||||||
|           image: docker.io/bitnami/nginx:1.23.3 |  | ||||||
|           imagePullPolicy: "IfNotPresent" |  | ||||||
|           env: |  | ||||||
|             - name: BITNAMI_DEBUG |  | ||||||
|               value: "false" |  | ||||||
|             - name: NGINX_HTTP_PORT_NUMBER |  | ||||||
|               value: "8080" |  | ||||||
|           envFrom: |  | ||||||
|           ports: |  | ||||||
|             - name: http |  | ||||||
|               containerPort: 8080 |  | ||||||
|           livenessProbe: |  | ||||||
|             failureThreshold: 6 |  | ||||||
|             initialDelaySeconds: 30 |  | ||||||
|             periodSeconds: 10 |  | ||||||
|             successThreshold: 1 |  | ||||||
|             timeoutSeconds: 5 |  | ||||||
|             tcpSocket: |  | ||||||
|               port: http |  | ||||||
|           readinessProbe: |  | ||||||
|             failureThreshold: 3 |  | ||||||
|             initialDelaySeconds: 5 |  | ||||||
|             periodSeconds: 5 |  | ||||||
|             successThreshold: 1 |  | ||||||
|             timeoutSeconds: 3 |  | ||||||
|             tcpSocket: |  | ||||||
|               port: http |  | ||||||
|           resources: |  | ||||||
|             limits: {} |  | ||||||
|             requests: {} |  | ||||||
|           volumeMounts: |  | ||||||
|       volumes: |  | ||||||
| 
 |  | ||||||
|  | @ -2,14 +2,7 @@ test_start "happypath - simple rollout of httpbin chart" | ||||||
| 
 | 
 | ||||||
| happypath_case_input_dir="${cases_dir}/happypath/input" | happypath_case_input_dir="${cases_dir}/happypath/input" | ||||||
| happypath_case_output_dir="${cases_dir}/happypath/output" | happypath_case_output_dir="${cases_dir}/happypath/output" | ||||||
| config_file="happypath.yaml" | config_file="happypath.yaml.gotmpl" | ||||||
| 
 |  | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${happypath_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| 
 | 
 | ||||||
| info "Diffing ${happypath_case_input_dir}/${config_file}" | info "Diffing ${happypath_case_input_dir}/${config_file}" | ||||||
| bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} diff --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff" | bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} diff --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff" | ||||||
|  |  | ||||||
|  | @ -1,14 +1,7 @@ | ||||||
| postrender_case_input_dir="${cases_dir}/postrender/input" | postrender_case_input_dir="${cases_dir}/postrender/input" | ||||||
| postrender_case_output_dir="${cases_dir}/postrender/output" | postrender_case_output_dir="${cases_dir}/postrender/output" | ||||||
| 
 | 
 | ||||||
| config_file="helmfile.yaml" | config_file="helmfile.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${postrender_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| postrender_diff_out_file=${postrender_case_output_dir}/diff-result | postrender_diff_out_file=${postrender_case_output_dir}/diff-result | ||||||
| if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then | if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then | ||||||
|     postrender_diff_out_file=${postrender_case_output_dir}/diff-result-live |     postrender_diff_out_file=${postrender_case_output_dir}/diff-result-live | ||||||
|  |  | ||||||
|  | @ -4,44 +4,20 @@ test_start "regression tests" | ||||||
| regression_case_input_dir="${cases_dir}/regression/input" | regression_case_input_dir="${cases_dir}/regression/input" | ||||||
| 
 | 
 | ||||||
| info "https://github.com/roboll/helmfile/issues/1857" | info "https://github.com/roboll/helmfile/issues/1857" | ||||||
| config_file="issue.1857.yaml" | config_file="issue.1857.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${regression_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=true template | grep grafana 1>/dev/null) || fail "\"helmfile template\" shouldn't include grafana" | (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=true template | grep grafana 1>/dev/null) || fail "\"helmfile template\" shouldn't include grafana" | ||||||
| ! (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=false template | grep grafana) || fail "\"helmfile template\" shouldn't include grafana" | ! (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=false template | grep grafana) || fail "\"helmfile template\" shouldn't include grafana" | ||||||
| 
 | 
 | ||||||
| info "https://github.com/roboll/helmfile/issues/1867" | info "https://github.com/roboll/helmfile/issues/1867" | ||||||
| config_file="issue.1867.yaml" | config_file="issue.1867.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${regression_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| (${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" | (${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" | ||||||
| 
 | 
 | ||||||
| info "https://github.com/roboll/helmfile/issues/2118" | info "https://github.com/roboll/helmfile/issues/2118" | ||||||
| config_file="issue.2118.yaml" | config_file="issue.2118.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${regression_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| (${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" | (${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail" | ||||||
| 
 | 
 | ||||||
| info "https://github.com/helmfile/helmfile/issues/1682" | info "https://github.com/helmfile/helmfile/issues/1682" | ||||||
| config_file="issue.1682.yaml" | config_file="issue.1682.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${regression_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| (${helmfile} -f ${regression_case_input_dir}/${config_file} deps 1>/dev/null) || fail "\"helmfile deps\" shouldn't fail" | (${helmfile} -f ${regression_case_input_dir}/${config_file} deps 1>/dev/null) || fail "\"helmfile deps\" shouldn't fail" | ||||||
| 
 | 
 | ||||||
| test_pass "regression tests" | test_pass "regression tests" | ||||||
|  | @ -4,13 +4,7 @@ sops="sops --hc-vault-transit $VAULT_ADDR/v1/sops/keys/key" | ||||||
| 
 | 
 | ||||||
| secretssops_case_input_dir="${cases_dir}/secretssops/input" | secretssops_case_input_dir="${cases_dir}/secretssops/input" | ||||||
| secretssops_case_output_dir="${cases_dir}/secretssops/output" | secretssops_case_output_dir="${cases_dir}/secretssops/output" | ||||||
| config_file="secretssops.yaml" | config_file="secretssops.yaml.gotmpl" | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then |  | ||||||
|   pushd "${secretssops_case_input_dir}" |  | ||||||
|   mv "${config_file}" "${config_file}.gotmpl" |  | ||||||
|   config_file="${config_file}.gotmpl" |  | ||||||
|   popd |  | ||||||
| fi |  | ||||||
| 
 | 
 | ||||||
| mkdir -p ${secretssops_case_input_dir}/tmp | mkdir -p ${secretssops_case_input_dir}/tmp | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,19 +1,15 @@ | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then | v1_subhelmfile_multi_bases_with_array_values_input_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/input" | ||||||
|   v1_subhelmfile_multi_bases_with_array_values_input_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/input" | v1_subhelmfile_multi_bases_with_array_values_output_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/output" | ||||||
|   v1_subhelmfile_multi_bases_with_array_values_output_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/output" |  | ||||||
| 
 | 
 | ||||||
|   yaml_overwrite_tmp=$(mktemp -d) | yaml_overwrite_tmp=$(mktemp -d) | ||||||
|   yaml_overwrite_reverse=${yaml_overwrite_tmp}/helmfile_template_result | yaml_overwrite_reverse=${yaml_overwrite_tmp}/helmfile_template_result | ||||||
| 
 | 
 | ||||||
|   test_start "v1 subhelmfile multi bases with array values" | test_start "v1 subhelmfile multi bases with array values" | ||||||
|   info "Comparing v1 subhelmfile multi bases with array values output ${yaml_overwrite_reverse} with ${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result" | info "Comparing v1 subhelmfile multi bases with array values output ${yaml_overwrite_reverse} with ${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result" | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|       info "Comparing build/v1-subhelmfile-multi-bases-with-array-values #$i" |     info "Comparing build/v1-subhelmfile-multi-bases-with-array-values #$i" | ||||||
|       ${helmfile} -f ${v1_subhelmfile_multi_bases_with_array_values_input_dir}/helmfile.yaml.gotmpl template -e dev &> ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" |     ${helmfile} -f ${v1_subhelmfile_multi_bases_with_array_values_input_dir}/helmfile.yaml.gotmpl template -e dev &> ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" | ||||||
|       diff -u ${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" |     diff -u ${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" | ||||||
|       echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
|   test_pass "v1 subhelmfile multi bases with array values" | test_pass "v1 subhelmfile multi bases with array values" | ||||||
| else |  | ||||||
|   test_pass "[skipped] v1 subhelmfile multi bases with array values" |  | ||||||
| fi |  | ||||||
|  | @ -1,19 +1,15 @@ | ||||||
| if [[ ${HELMFILE_V1MODE} = true ]]; then | yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input" | ||||||
|   yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input" | yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output" | ||||||
|   yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output" |  | ||||||
| 
 | 
 | ||||||
|   yaml_overwrite_tmp=$(mktemp -d) | yaml_overwrite_tmp=$(mktemp -d) | ||||||
|   yaml_overwrite_reverse=${yaml_overwrite_tmp}/yaml.override.build.yaml | yaml_overwrite_reverse=${yaml_overwrite_tmp}/yaml.override.build.yaml | ||||||
| 
 | 
 | ||||||
|   test_start "yaml overwrite feature" | test_start "yaml overwrite feature" | ||||||
|   info "Comparing yaml overwrite feature output ${yaml_overwrite_reverse} with ${yaml_overwrite_case_output_dir}/overwritten.yaml" | info "Comparing yaml overwrite feature output ${yaml_overwrite_reverse} with ${yaml_overwrite_case_output_dir}/overwritten.yaml" | ||||||
|   for i in $(seq 10); do | for i in $(seq 10); do | ||||||
|       info "Comparing build/yaml-overwrite #$i" |     info "Comparing build/yaml-overwrite #$i" | ||||||
|       ${helmfile} -f ${yaml_overwrite_case_input_dir}/issue.657.yaml.gotmpl template --skip-deps > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" |     ${helmfile} -f ${yaml_overwrite_case_input_dir}/issue.657.yaml.gotmpl template --skip-deps > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail" | ||||||
|       ./dyff between -bs ${yaml_overwrite_case_output_dir}/overwritten.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" |     ./dyff between -bs ${yaml_overwrite_case_output_dir}/overwritten.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent" | ||||||
|       echo code=$? |     echo code=$? | ||||||
|   done | done | ||||||
|   test_pass "yaml overwrite feature" | test_pass "yaml overwrite feature" | ||||||
| else |  | ||||||
|   test_pass "[skipped] yaml overwrite feature" |  | ||||||
| fi |  | ||||||
		Loading…
	
		Reference in New Issue