diff --git a/.github/workflows/validate-k8s-manifests.yml b/.github/workflows/validate-k8s-manifests.yml
index 3a553e1..b6150f6 100644
--- a/.github/workflows/validate-k8s-manifests.yml
+++ b/.github/workflows/validate-k8s-manifests.yml
@@ -8,11 +8,17 @@
name: render helm charts and validate k8s manifests
on:
workflow_call:
+ inputs:
+ strict:
+ required: false
+ description: "Run kubeconform with strict validation"
+ default: false
+ type: boolean
env:
HEAD_REF: ${{ github.head_ref }}
- KUBECONFORM_VERSION: "0.6.7"
- KUBECONFORM_SHA256: "95f14e87aa28c09d5941f11bd024c1d02fdc0303ccaa23f61cef67bc92619d73"
+ KUBECONFORM_VERSION: "0.7.0"
+ KUBECONFORM_SHA256: "c31518ddd122663b3f3aa874cfe8178cb0988de944f29c74a0b9260920d115d3"
KUBECONFORM_BASE_URL: "https://github.com/yannh/kubeconform/releases/download"
KUBECONFORM_SCHEMA_LOCATION: "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json"
KUBECONFORM_CUSTOM_SCHEMA_LOCATION: "https://raw.githubusercontent.com/mozilla/mozcloud/main/crdSchemas/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json"
@@ -110,7 +116,17 @@ jobs:
- name: validate k8s manifests
id: validate_k8s_manifests
+ env:
+ STRICT: ${{ inputs.strict }}
+ CHARTS: ${{ needs.get_changed_helm_charts.outputs.charts }}
run: |
+ set -euo pipefail
+
+ # Optional strict flag
+ STRICT_FLAG=""
+ if [ "${STRICT}" = "true" ]; then
+ STRICT_FLAG="-strict"
+ fi
# To support multi-chart tenants we need to normalize the kubeconform output
# We are populating it with the standard kubeconform structure, but will append to these values during subsequent runs
echo '{"summary":{"valid":0,"invalid":0,"errors":0,"skipped":0},"resources":[]}' > kubeconform.json
@@ -124,6 +140,7 @@ jobs:
# Always run kubeconform and capture output, even if it fails
/usr/local/bin/kubeconform \
+ ${STRICT_FLAG} \
-schema-location default \
-schema-location "${KUBECONFORM_SCHEMA_LOCATION}" \
-schema-location "${KUBECONFORM_CUSTOM_SCHEMA_LOCATION}" \
@@ -158,8 +175,6 @@ jobs:
done
echo "kubeconform_exit_code=$exit_code" >> $GITHUB_OUTPUT
- env:
- CHARTS: ${{ needs.get_changed_helm_charts.outputs.charts }}
- name: minimize previous kubeconform comments
uses: actions/github-script@v8
@@ -215,8 +230,6 @@ jobs:
return `${r.filename} - ${r.kind} ${r.name} failed validation: ${r.msg}`;
}).join('\n');
- const fullOutput = `Show full output
\n\n\`\`\`text\n${errorDetails}\n\`\`\`\n `;
-
const sepEnd = "\n```\n\n\nNote: Continued in next comment.";
const sepStart = "Continued from previous comment:\nShow full output
\n\n```text\n";
const comStart = `${summaryLine}\n\nShow full output
\n\n\`\`\`text\n`;