diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4dab68bd..df4b705e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,8 +26,6 @@ jobs: check-latest: true - uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0 - with: - version: v3.14.4 - name: Install GoReleaser uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 @@ -111,4 +109,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: - version: v1.57 + version: v1.61 diff --git a/.goreleaser.yml b/.goreleaser.yml index c5d37aa9..a10ab966 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,4 +1,5 @@ project_name: chart-testing +version: 2 env: - COSIGN_YES=true @@ -46,7 +47,7 @@ checksum: name_template: 'checksums.txt' snapshot: - name_template: "{{ .Tag }}-next" + version_template: "{{ .Tag }}-next" dockers: - skip_push: false diff --git a/ct/cmd/lint.go b/ct/cmd/lint.go index 71e86810..5c9b421d 100644 --- a/ct/cmd/lint.go +++ b/ct/cmd/lint.go @@ -69,6 +69,8 @@ func addLintFlags(flags *flag.FlagSet) { Enable schema validation of 'Chart.yaml' using Yamale`)) flags.Bool("validate-yaml", true, heredoc.Doc(` Enable linting of 'Chart.yaml' and values files`)) + flags.Bool("skip-helm-dependencies", false, heredoc.Doc(` + Skip running 'helm dependency build' before linting`)) flags.StringSlice("additional-commands", []string{}, heredoc.Doc(` Additional commands to run per chart (default: []) Commands will be executed in the same order as provided in the list and will diff --git a/doc/ct_lint-and-install.md b/doc/ct_lint-and-install.md index 215a70fe..924f02bc 100644 --- a/doc/ct_lint-and-install.md +++ b/doc/ct_lint-and-install.md @@ -66,6 +66,7 @@ ct lint-and-install [flags] --remote string The name of the Git remote used to identify changed charts (default "origin") --since string The Git reference used to identify changed charts (default "HEAD") --skip-clean-up Skip resources clean-up. Used if need to continue other flows or keep it around. + --skip-helm-dependencies Skip running 'helm dependency build' before linting --skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the previous chart revision if they have been deleted or renamed at the current chart revision diff --git a/doc/ct_lint.md b/doc/ct_lint.md index a08644aa..738d8001 100644 --- a/doc/ct_lint.md +++ b/doc/ct_lint.md @@ -69,6 +69,7 @@ ct lint [flags] expose sensitive data when helm-repo-extra-args contains passwords) --remote string The name of the Git remote used to identify changed charts (default "origin") --since string The Git reference used to identify changed charts (default "HEAD") + --skip-helm-dependencies Skip running 'helm dependency build' before linting --target-branch string The name of the target branch used to identify changed charts (default "main") --use-helmignore Use .helmignore when identifying changed charts --validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default true) diff --git a/go.mod b/go.mod index 6a4e9f9a..a48f92f9 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/helm/chart-testing/v3 -go 1.22.0 - -toolchain go1.22.4 +go 1.23 require ( github.com/MakeNowJust/heredoc v1.0.0 diff --git a/pkg/chart/chart.go b/pkg/chart/chart.go index 4790b825..227ecc71 100644 --- a/pkg/chart/chart.go +++ b/pkg/chart/chart.go @@ -384,17 +384,21 @@ func (t *Testing) processCharts(action func(chart *Chart) TestResult) ([]TestRes } defer t.git.RemoveWorktree(worktreePath) // nolint: errcheck - for _, chart := range charts { - if err := t.helm.BuildDependenciesWithArgs(t.computePreviousRevisionPath(chart.Path()), t.config.HelmDependencyExtraArgs); err != nil { - // Only print error (don't exit) if building dependencies for previous revision fails. - fmt.Printf("failed building dependencies for previous revision of chart %q: %v\n", chart, err.Error()) + if !t.config.SkipHelmDependencies { + for _, chart := range charts { + if err := t.helm.BuildDependenciesWithArgs(t.computePreviousRevisionPath(chart.Path()), t.config.HelmDependencyExtraArgs); err != nil { + // Only print error (don't exit) if building dependencies for previous revision fails. + fmt.Printf("failed building dependencies for previous revision of chart %q: %v\n", chart, err.Error()) + } } } } for _, chart := range charts { - if err := t.helm.BuildDependenciesWithArgs(chart.Path(), t.config.HelmDependencyExtraArgs); err != nil { - return nil, fmt.Errorf("failed building dependencies for chart %q: %w", chart, err) + if !t.config.SkipHelmDependencies { + if err := t.helm.BuildDependenciesWithArgs(chart.Path(), t.config.HelmDependencyExtraArgs); err != nil { + return nil, fmt.Errorf("failed building dependencies for chart %q: %w", chart, err) + } } result := action(chart) diff --git a/pkg/config/config.go b/pkg/config/config.go index 989c467b..d87bafe1 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -52,6 +52,7 @@ type Configuration struct { ValidateMaintainers bool `mapstructure:"validate-maintainers"` ValidateChartSchema bool `mapstructure:"validate-chart-schema"` ValidateYaml bool `mapstructure:"validate-yaml"` + SkipHelmDependencies bool `mapstructure:"skip-helm-dependencies"` AdditionalCommands []string `mapstructure:"additional-commands"` CheckVersionIncrement bool `mapstructure:"check-version-increment"` ProcessAllCharts bool `mapstructure:"all"`