Skip to content

Commit 715c707

Browse files
authored
Merge pull request #4 from sebrandon1/add_daily_preflight
Add nightly openshift-preflight run against debug image
2 parents f8d2355 + 40359ef commit 715c707

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/preflight.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: Preflight Daily
3+
'on':
4+
schedule:
5+
- cron: '0 0 * * *'
6+
# pull_request:
7+
# branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
preflight-debug-partner:
12+
runs-on: ubuntu-22.04
13+
env:
14+
SHELL: /bin/bash
15+
IMAGE_NAME: quay.io/testnetworkfunction/k8s-best-practices-debug:latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Go 1.22
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: 1.22.5
24+
25+
- name: Disable default go problem matcher
26+
run: echo "::remove-matcher owner=go::"
27+
28+
- name: Clone the preflight repository
29+
uses: actions/checkout@v4
30+
with:
31+
repository: redhat-openshift-ecosystem/openshift-preflight
32+
path: openshift-preflight
33+
34+
- name: Run preflight
35+
working-directory: openshift-preflight
36+
run: |
37+
make build
38+
./preflight check container ${{ env.IMAGE_NAME }} --artifacts ${GITHUB_WORKSPACE}/openshift-preflight/artifacts
39+
40+
ALLOWED_FAILURES=("HasLicense" "RunAsNonRoot")
41+
FAILURES=$(cat ${GITHUB_WORKSPACE}/openshift-preflight/artifacts/amd64/results.json | jq -r '.results.failed[].name')
42+
43+
for FAILURE in $FAILURES; do
44+
FAILURE=$(echo $FAILURE | tr -d '"')
45+
if [[ ! " ${ALLOWED_FAILURES[@]} " =~ " ${FAILURE} " ]]; then
46+
echo "ERROR: $FAILURE is not an allowed failure"
47+
exit 1
48+
fi
49+
done

0 commit comments

Comments
 (0)