Skip to content

Commit

Permalink
fix: helm-conftest step
Browse files Browse the repository at this point in the history
Signed-off-by: Brenno Oliveira <[email protected]>
  • Loading branch information
brennoo committed Aug 19, 2024
1 parent b55741a commit e4a1fe2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/helm-conftest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]

- 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
18 changes: 1 addition & 17 deletions ci/helm-conftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,12 @@

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 "=============================================================="
echo "helm-conftest running for chart: ${chart}..."
# 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)

0 comments on commit e4a1fe2

Please sign in to comment.