Skip to content

Commit

Permalink
Directly source test config for testable profiles
Browse files Browse the repository at this point in the history
Let's directly parse the source of CI Job configuration to know what
profiles we can trigger jobs for.

Also, move it out of the rule iteration loop. We just need to define it
once.
  • Loading branch information
yuumasato committed Oct 29, 2024
1 parent c163ed8 commit 2999443
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ocp-test-profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ jobs:
if: ${{ steps.ctf.outputs.CTF_OUTPUT_SIZE != '0' && (contains(steps.product.outputs.prop, 'ocp4') || contains(steps.product.outputs.prop, 'rhcos4')) }}
id: profiles_to_test
run: |
# Let's grab the profiles for which we have a CI job configured
PROW_CONFIG=https://raw.githubusercontent.com/openshift/release/refs/heads/master/ci-operator/config/ComplianceAsCode/content/ComplianceAsCode-content-master.yaml
curl -o prow_config.yaml ${PROW_CONFIG}
readarray -t TESTED_PROFILES <<< $(grep -r PROFILE= ./prow_config.yaml | sort -u | sed 's/.*export PROFILE=\(.*\)/\1/')
RULES=$(cat ctf-output.json | jq -r '.rules[]')
# Let's grab one profile for each changed rule
Expand All @@ -74,13 +79,6 @@ jobs:
for rule in $RULES; do
readarray -t TEMP <<< $(grep -lr -e "- ${rule}\$" build/*/profiles | sort)
# Let's ilter out profiles for which we don't have a CI job configured
# Here is an example of how to quicly update this variable in the future
# TESTED_PROFILES=$(grep -r PROFILE= ./ComplianceAsCode-content-master__4.16.yaml | sort -u | sed 's/.*export PROFILE=\(.*\)/\1/')
# echo -n TESTED_PROFILES=\(${TESTED_PROFILES[@]}\)
# Copy and paste the profiles here
TESTED_PROFILES=(bsi bsi-node cis cis-node e8 high high-node moderate moderate-node pci-dss pci-dss-4-0 pci-dss-node pci-dss-node-4-0 stig stig-node)
ELIGIBLE_PROFILES=()
for index in "${!TEMP[@]}"; do
for tp in ${TESTED_PROFILES[@]}; do
Expand Down

0 comments on commit 2999443

Please sign in to comment.