-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cron to run preflight against unstable image (#1569)
* Add cron to run preflight against unstable image * Address comments --------- Co-authored-by: David Rabkin <[email protected]>
- Loading branch information
1 parent
fc0e15d
commit 24baf2b
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: Preflight | ||
'on': | ||
schedule: | ||
- cron: '0 0 * * *' | ||
# pull_request: | ||
# branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
preflight-unstable: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
SHELL: /bin/bash | ||
IMAGE_NAME: quay.io/testnetworkfunction/cnf-certification-test:unstable | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go 1.21 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.3 | ||
|
||
- name: Disable default go problem matcher | ||
run: echo "::remove-matcher owner=go::" | ||
|
||
- name: Clone the preflight repository | ||
uses: actions/checkout@v4 | ||
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") | ||
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 |