diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 31bab20c..5aa9e321 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3 + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 with: fetch-depth: 0 @@ -20,25 +20,25 @@ jobs: uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0 - name: Setup go - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v3.3.0 + uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version-file: './go.mod' check-latest: true - uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 with: - version: v3.11.0 + version: v3.11.2 - name: Install GoReleaser - uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v3.1.0 + uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 with: install-only: true - name: Install cosign - uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v2.6.0 + uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1 - name: Install syft - uses: anchore/sbom-action/download-syft@448520c4f19577ffce70a8317e619089054687e3 # v0.13.4 + uses: anchore/sbom-action/download-syft@448520c4f19577ffce70a8317e619089054687e3 # v0.14.0 - name: Install k8s Kind uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00 # v1.3.0 @@ -65,10 +65,10 @@ jobs: git diff --exit-code - name: Set up QEMU - uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.0.0 + uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.0.0 + uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0 - name: Build run: | @@ -82,8 +82,8 @@ jobs: name: check-docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v3 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version-file: './go.mod' check-latest: true @@ -103,12 +103,12 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3 - - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v3 + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 + - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version-file: './go.mod' check-latest: true - name: golangci-lint uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3 with: - version: v1.51.0 + version: v1.52.1 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8c2ac197..98edc758 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.0.1 + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 with: fetch-depth: 0 @@ -25,21 +25,21 @@ jobs: uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0 - name: Setup go - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v3.3.0 + uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 with: go-version-file: './go.mod' check-latest: true - name: Install GoReleaser - uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v3.1.0 + uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 with: install-only: true - name: Install cosign - uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v2.6.0 + uses: sigstore/cosign-installer@c3667d99424e7e6047999fb6246c0da843953c65 # v3.0.1 - name: Install syft - uses: anchore/sbom-action/download-syft@448520c4f19577ffce70a8317e619089054687e3 # v0.13.4 + uses: anchore/sbom-action/download-syft@448520c4f19577ffce70a8317e619089054687e3 # v0.14.0 - name: Install tools run: | @@ -53,13 +53,13 @@ jobs: git diff --exit-code - name: Set up QEMU - uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.0.0 + uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.0.0 + uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0 - name: Login to registry - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.0.0 + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 with: registry: quay.io username: ${{ secrets.DOCKER_USERNAME }} diff --git a/.golangci.yml b/.golangci.yml index ba3c1ee2..36164d66 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -24,6 +24,7 @@ issues: linters: - errcheck - gosec + - revive max-issues-per-linter: 0 max-same-issues: 0 run: diff --git a/.goreleaser.yml b/.goreleaser.yml index 8de683ae..8acb9c2a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,14 +1,14 @@ project_name: chart-testing env: - - COSIGN_EXPERIMENTAL=true + - COSIGN_YES=true before: hooks: - go mod download sboms: -- artifacts: archive + - artifacts: archive builds: - main: ct/main.go @@ -92,14 +92,14 @@ dockers: - etc/lintconf.yaml docker_manifests: -- name_template: quay.io/helmpack/chart-testing:latest - image_templates: - - quay.io/helmpack/chart-testing:latest-amd64 - - quay.io/helmpack/chart-testing:latest-arm64 -- name_template: quay.io/helmpack/chart-testing:{{ .Tag }} - image_templates: - - quay.io/helmpack/chart-testing:{{ .Tag }}-amd64 - - quay.io/helmpack/chart-testing:{{ .Tag }}-arm64 + - name_template: quay.io/helmpack/chart-testing:latest + image_templates: + - quay.io/helmpack/chart-testing:latest-amd64 + - quay.io/helmpack/chart-testing:latest-arm64 + - name_template: quay.io/helmpack/chart-testing:{{ .Tag }} + image_templates: + - quay.io/helmpack/chart-testing:{{ .Tag }}-amd64 + - quay.io/helmpack/chart-testing:{{ .Tag }}-arm64 signs: - id: all diff --git a/ct/cmd/docGen.go b/ct/cmd/docGen.go index 8e3f450b..bf7ea8b6 100644 --- a/ct/cmd/docGen.go +++ b/ct/cmd/docGen.go @@ -34,7 +34,7 @@ func newGenerateDocsCmd() *cobra.Command { } } -func generateDocs(cmd *cobra.Command, args []string) error { +func generateDocs(_ *cobra.Command, _ []string) error { fmt.Println("Generating docs...") err := doc.GenMarkdownTree(NewRootCmd(), "doc") diff --git a/ct/cmd/install.go b/ct/cmd/install.go index 0fb5d0f0..96523f3c 100644 --- a/ct/cmd/install.go +++ b/ct/cmd/install.go @@ -84,7 +84,7 @@ func addInstallFlags(flags *flag.FlagSet) { Skip resources clean-up. Used if need to continue other flows or keep it around.`)) } -func install(cmd *cobra.Command, args []string) error { +func install(cmd *cobra.Command, _ []string) error { fmt.Println("Installing charts...") printConfig, err := cmd.Flags().GetBool("print-config") diff --git a/ct/cmd/lint.go b/ct/cmd/lint.go index dd36f0f7..c5b015cc 100644 --- a/ct/cmd/lint.go +++ b/ct/cmd/lint.go @@ -76,7 +76,7 @@ func addLintFlags(flags *flag.FlagSet) { Example: "helm unittest --helm3 -f tests/*.yaml {{ .Path }}"`)) } -func lint(cmd *cobra.Command, args []string) error { +func lint(cmd *cobra.Command, _ []string) error { fmt.Println("Linting charts...") printConfig, err := cmd.Flags().GetBool("print-config") diff --git a/ct/cmd/lintAndInstall.go b/ct/cmd/lintAndInstall.go index c42a6494..d885033c 100644 --- a/ct/cmd/lintAndInstall.go +++ b/ct/cmd/lintAndInstall.go @@ -39,7 +39,7 @@ func newLintAndInstallCmd() *cobra.Command { return cmd } -func lintAndInstall(cmd *cobra.Command, args []string) error { +func lintAndInstall(cmd *cobra.Command, _ []string) error { fmt.Println("Linting and installing charts...") printConfig, err := cmd.Flags().GetBool("print-config") diff --git a/ct/cmd/listChanged.go b/ct/cmd/listChanged.go index 412f7c1a..177e9df5 100644 --- a/ct/cmd/listChanged.go +++ b/ct/cmd/listChanged.go @@ -40,7 +40,7 @@ func newListChangedCmd() *cobra.Command { return cmd } -func listChanged(cmd *cobra.Command, args []string) error { +func listChanged(cmd *cobra.Command, _ []string) error { printConfig, err := cmd.Flags().GetBool("print-config") if err != nil { return err diff --git a/ct/cmd/version.go b/ct/cmd/version.go index d13a4f52..522122cb 100644 --- a/ct/cmd/version.go +++ b/ct/cmd/version.go @@ -37,7 +37,7 @@ func newVersionCmd() *cobra.Command { } } -func version(cmd *cobra.Command, args []string) { +func version(_ *cobra.Command, _ []string) { fmt.Println("Version:\t", Version) fmt.Println("Git commit:\t", GitCommit) fmt.Println("Date:\t\t", BuildDate) diff --git a/pkg/chart/chart.go b/pkg/chart/chart.go index ac575d9a..7287da85 100644 --- a/pkg/chart/chart.go +++ b/pkg/chart/chart.go @@ -650,10 +650,8 @@ func (t *Testing) testRelease(namespace, release, releaseSelector string) error if err := t.kubectl.WaitForDeployments(namespace, releaseSelector); err != nil { return err } - if err := t.helm.Test(namespace, release); err != nil { - return err - } - return nil + + return t.helm.Test(namespace, release) } func (t *Testing) generateInstallConfig(chart *Chart) (namespace, release, releaseSelector string, cleanup func()) { diff --git a/pkg/tool/helm.go b/pkg/tool/helm.go index 4b5f763d..e257126c 100644 --- a/pkg/tool/helm.go +++ b/pkg/tool/helm.go @@ -61,21 +61,13 @@ func (h Helm) InstallWithValues(chart string, valuesFile string, namespace strin values = []string{"--values", valuesFile} } - if err := h.exec.RunProcess("helm", "install", release, chart, "--namespace", namespace, - "--wait", values, h.extraArgs, h.extraSetArgs); err != nil { - return err - } - - return nil + return h.exec.RunProcess("helm", "install", release, chart, "--namespace", namespace, + "--wait", values, h.extraArgs, h.extraSetArgs) } func (h Helm) Upgrade(chart string, namespace string, release string) error { - if err := h.exec.RunProcess("helm", "upgrade", release, chart, "--namespace", namespace, - "--reuse-values", "--wait", h.extraArgs, h.extraSetArgs); err != nil { - return err - } - - return nil + return h.exec.RunProcess("helm", "upgrade", release, chart, "--namespace", namespace, + "--reuse-values", "--wait", h.extraArgs, h.extraSetArgs) } func (h Helm) Test(namespace string, release string) error {