diff --git a/.github/workflows/k8s-content-pr-test.yaml b/.github/workflows/k8s-content-pr-test.yaml new file mode 100644 index 000000000000..36d906e9c597 --- /dev/null +++ b/.github/workflows/k8s-content-pr-test.yaml @@ -0,0 +1,42 @@ +--- +name: Gate / Kubernetes Test Content Parsing + +on: + pull_request: + types: + - opened + - reopened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.run_id }} + cancel-in-progress: true + +jobs: + datastream-parsing: + name: XCCDF Datastream parsing + runs-on: ubuntu-latest + steps: + - name: Copy XCCDF files from existing content image + uses: nick-fields/retry@v3 + with: + timeout_minutes: 15 + max_attempts: 3 + retry_wait_seconds: 120 + retry_on: error + command: | + mkdir -p content + docker pull ghcr.io/complianceascode/k8scontent:${{ github.event.number }} + docker run --rm -v $PWD/content:/content:z ghcr.io/complianceascode/k8scontent:${{ github.event.number }} bash -c "cp *.xml /content" + - name: Clone compliance operator repository + run: | + git clone https://github.com/ComplianceAsCode/compliance-operator.git + - uses: actions/setup-go@v5 + with: + go-version: '>=1.19.0' + - name: Run ginkgo tests and check if each XCCDF file is parsed correctly + run: | + export CONTENT_FOLDER=$PWD/content + cd compliance-operator + make test-datastreams +