Skip to content

Commit 894dfa9

Browse files
committed
OCP4: Add workflow to test ocp content
Add this workflow so we can test ocp4 content can be parsed on each PR
1 parent b895bce commit 894dfa9

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: Gate / Kubernetes Test Content Parsing
3+
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- reopened
9+
- synchronize
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.number || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
datastream-parsing:
17+
name: XCCDF Datastream parsing
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Copy XCCDF files from existing content image
21+
uses: nick-fields/retry@v3
22+
with:
23+
timeout_minutes: 15
24+
max_attempts: 3
25+
retry_wait_seconds: 120
26+
retry_on: error
27+
command: |
28+
mkdir -p content
29+
docker pull ghcr.io/complianceascode/k8scontent:${{ github.event.number }}
30+
docker run --rm -v $PWD/content:/content:z ghcr.io/complianceascode/k8scontent:${{ github.event.number }} bash -c "cp *.xml /content"
31+
- name: Clone compliance operator repository
32+
run: |
33+
git clone https://github.com/ComplianceAsCode/compliance-operator.git
34+
- name: Fetch go version used in compliance-operator go.mod
35+
run: |
36+
cd compliance-operator
37+
go mod edit -json | jq -r '.Go' > go-version
38+
if [ ! -s go-version ]; then
39+
echo "Failed to fetch go version from compliance-operator go.mod"
40+
exit 1
41+
fi
42+
- uses: actions/setup-go@v5
43+
with:
44+
go-version: $(cat compliance-operator/go-version)
45+
- name: Run ginkgo tests and check if each XCCDF file is parsed correctly
46+
run: |
47+
export DEFAULT_CONTENT_DS_FILE_PATH=$PWD/content
48+
cd compliance-operator
49+
make test-datastreams

0 commit comments

Comments
 (0)