Preflight #386
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Preflight | |
'on': | |
schedule: | |
- cron: '0 0 * * *' | |
# pull_request: | |
# branches: [ main ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
preflight-latest: | |
runs-on: ubuntu-22.04 | |
env: | |
SHELL: /bin/bash | |
IMAGE_NAME: quay.io/redhat-best-practices-for-k8s/oct:latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Go 1.23 | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: 1.23.2 | |
- name: Disable default go problem matcher | |
run: echo "::remove-matcher owner=go::" | |
- name: Clone the preflight repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: redhat-openshift-ecosystem/openshift-preflight | |
path: openshift-preflight | |
- name: Run preflight | |
working-directory: openshift-preflight | |
run: | | |
make build | |
./preflight check container ${{ env.IMAGE_NAME }} --artifacts ${GITHUB_WORKSPACE}/openshift-preflight/artifacts | |
ALLOWED_FAILURES=("HasLicense" "RunAsNonRoot" "HasUniqueTag") | |
FAILURES=$(cat ${GITHUB_WORKSPACE}/openshift-preflight/artifacts/amd64/results.json | jq -r '.results.failed[].name') | |
for FAILURE in $FAILURES; do | |
FAILURE=$(echo $FAILURE | tr -d '"') | |
if [[ ! "${ALLOWED_FAILURES[@]}" =~ "${FAILURE}" ]]; then | |
echo >&2 "ERROR: $FAILURE is not an allowed failure" | |
exit 1 | |
fi | |
done | |