Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable/none] fix: helm-conftest step #598

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/helm-conftest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ 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 tar

- name: Install Conftest
run: |
curl -sSL https://github.com/open-policy-agent/conftest/releases/download/v0.55.0/conftest_0.55.0_Linux_x86_64.tar.gz -o conftest.tar.gz
tar -xzvf conftest.tar.gz -C /usr/local/bin/
chmod +x /usr/local/bin/conftest
rm conftest.tar.gz

- 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)
Loading