From 0e6563c6feb8ac46215e6386a7b3a6aee7a1722e Mon Sep 17 00:00:00 2001 From: cpanato Date: Fri, 29 Mar 2024 16:59:56 +0100 Subject: [PATCH] refactor helm ci tests part I Signed-off-by: cpanato --- hack/verify-chart-lint.sh => .ct.yaml | 18 ++++++++--------- .github/workflows/ci.yaml | 28 +++++++++++++++++++-------- 2 files changed, 29 insertions(+), 17 deletions(-) rename hack/verify-chart-lint.sh => .ct.yaml (68%) mode change 100755 => 100644 diff --git a/hack/verify-chart-lint.sh b/.ct.yaml old mode 100755 new mode 100644 similarity index 68% rename from hack/verify-chart-lint.sh rename to .ct.yaml index 1c661ae2b..acc5472ed --- a/hack/verify-chart-lint.sh +++ b/.ct.yaml @@ -1,6 +1,4 @@ -#!/bin/bash - -# Copyright 2020 The Kubernetes Authors. +# Copyright 2024 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,9 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -o errexit -set -o nounset -set -o pipefail - -KUBE_ROOT="$( cd "$(dirname "$0")../" >/dev/null 2>&1 ; pwd -P )" -ct lint --charts ${KUBE_ROOT}/charts/ingress-nginx --validate-maintainers=false +remote: origin +validate-maintainers: false +target-branch: main +chart-repos: + - ingress-nginx=https://kubernetes.github.io/ingress-nginx +helm-extra-args: --timeout 800s +chart-dirs: + - charts diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a033bbfa9..69c849d3a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -168,6 +168,7 @@ jobs: name: docker.tar.gz path: docker.tar.gz retention-days: 5 + helm: name: Helm chart runs-on: ubuntu-latest @@ -191,6 +192,18 @@ jobs: go-version: ${{ needs.build.outputs.golangversion }} check-latest: true + - name: Set up Helm + uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 + with: + version: '3.14.3' + + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + with: + python-version: '3.x' + + - name: Set up chart-testing + uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 + - name: Install Helm Unit Test Plugin run: | helm plugin install https://github.com/helm-unittest/helm-unittest @@ -199,14 +212,8 @@ jobs: run: | helm unittest charts/ingress-nginx -d - - name: cache - uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 - with: - name: docker.tar.gz - - - name: Lint - run: | - ./build/run-in-docker.sh ./hack/verify-chart-lint.sh + - name: Run chart-testing (lint) + run: ct lint --config ct.yaml - name: Run helm-docs run: | @@ -227,6 +234,11 @@ jobs: ./ah lint -p charts/ingress-nginx || exit 1 rm -f ./ah ./ah_1.5.0_linux_amd64.tar.gz + - name: cache + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: docker.tar.gz + - name: fix permissions run: | sudo mkdir -p $HOME/.kube