diff --git a/.github/workflows/helm-conftest.yaml b/.github/workflows/helm-conftest.yaml index 20a7f9b7..15cc2142 100644 --- a/.github/workflows/helm-conftest.yaml +++ b/.github/workflows/helm-conftest.yaml @@ -5,10 +5,19 @@ jobs: name: Run conftest for all charts runs-on: ubuntu-latest container: - image: instrumenta/helm-conftest:latest + image: alpine/helm:latest steps: - name: Checkout Code uses: actions/checkout@v4.1.7 + - name: Install Dependencies + run: apk add --no-cache curl + + - name: Install Conftest + run: | + curl -sSL https://github.com/open-policy-agent/conftest/releases/latest/download/conftest-linux-amd64 -o conftest + chmod +x conftest + mv conftest /usr/local/bin/ + - name: Validate all charts run: bash ci/helm-conftest.sh diff --git a/ci/helm-conftest.sh b/ci/helm-conftest.sh index 180946b3..cb772a20 100755 --- a/ci/helm-conftest.sh +++ b/ci/helm-conftest.sh @@ -2,22 +2,6 @@ set -euo pipefail -# Check if we are running in docker and ensure we have Helm3 if so -if [ -f "/.dockerenv" ]; then - CONFTEST="/root/.helm/plugins/helm-conftest/bin/conftest" - if helm version --client --short | grep -q 'v2.14'; then - echo "Running in docker but Helm version 2 found, will install Helm 3..." - export VERIFY_CHECKSUM=false - curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 - chmod 700 get_helm.sh - ./get_helm.sh --version "v3.6.2" - echo "Helm version now installed: " - helm version - fi -else - CONFTEST=$(which conftest) -fi - while IFS= read -r -d '' chart do echo "==============================================================" @@ -25,5 +9,5 @@ do # Remove any dependencies as we are not going to test them rm -f "${chart}/requirements.yaml" rm -rf "${chart}/charts" - helm template "${chart}" | $CONFTEST -p ci/helm-conftest-policies test - + helm template "${chart}" | conftest -p ci/helm-conftest-policies test - done < <(find stable -maxdepth 1 -mindepth 1 -print0)