Skip to content

Commit 1f9b336

Browse files
fix(psa-checker): only fail if PSS violations are found (#116)
## Description Modify psa-checker to only fail if PSS violations are found. Currently it will fail if a chart doesn't render, which tends to confuse users; this PR makes it so that will print a warning & pass the job, which is how the validate & helmdiff jobs behave. --- Old behavior: - Fail when one chart passes and one fails to render: https://github.com/mozilla/webservices-infra/actions/runs/19875028211/job/56960262267?pr=8635 - Fail in platform-shared: https://github.com/mozilla/global-platform-admin/actions/runs/20036540116/job/57459570627 New behavior: - Pass when one chart validates and one chart didn't render: https://github.com/mozilla/webservices-infra/actions/runs/20045553210/job/57490211960 - Pass when platform-shared fails to render (like it always does): https://github.com/mozilla/global-platform-admin/actions/runs/20045710877/job/57490735774?pr=4926 Also validated that it still properly fails when PSS violations are found: https://github.com/mozilla/webservices-infra/actions/runs/20045602041/job/57490375853?pr=8726 ## Related Tickets & Documents * MZCLD-1376 * SREIN-766
1 parent 0623f47 commit 1f9b336

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.github/workflows/psa-checker.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,25 @@ jobs:
5454
- name: download artifacts
5555
uses: actions/download-artifact@v6
5656
with:
57-
pattern: "k8s-manifests-*"
57+
pattern: k8s-manifests-*
5858
merge-multiple: true
5959
path: "shared"
6060
- name: run psa-checker
6161
id: psa_check
6262
shell: bash # sets the flags --noprofile --norc -eo pipefail
6363
env:
6464
PSS_LEVEL: ${{ inputs.pss_level }}
65-
CHART_DIR: ${{ matrix.chart }}
65+
CHART: ${{ matrix.chart }}
6666
run: |
67-
# Loop over templates from each environment dir and check PSS levels
67+
# Check pod security levels for templates in each chart
6868
docker pull $PSA_CHECKER_IMAGE:$PSA_CHECKER_SHA # Pull before run so the output is less messy
69-
cd "shared/charts/$CHART_DIR/"
70-
for ENV_DIR in */; do
71-
find $ENV_DIR -type f -exec cat {} + \
69+
echo "Checking PSS level for ${CHART}..."
70+
if [ -d "shared/charts/${CHART}" ]; then
71+
find "shared/charts/${CHART}" -type f -exec cat {} + \
7272
| docker run -i --rm $PSA_CHECKER_IMAGE:$PSA_CHECKER_SHA --level "$PSS_LEVEL" -f - \
7373
| grep -v "Non standard" \
7474
| grep -v "Kind not"
75-
done
75+
else
76+
# Fail only if PSS violations are found - if chart failed to render just print a warning
77+
echo "Warning: Rendered output for ${CHART} not found."
78+
fi

0 commit comments

Comments
 (0)