Skip to content

Commit

Permalink
Filter out profiles that are not tested by Prow
Browse files Browse the repository at this point in the history
Not all profiles are configured in Prow.
This uses a hardcoded list of profiles to filter out the
"untestable" ones.
  • Loading branch information
yuumasato committed Oct 28, 2024
1 parent c6c1b1f commit 0cf1bbf
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/ocp-test-profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,25 @@ jobs:
RANDOM=${{ github.event.pull_request.number }}
for rule in $RULES; do
readarray -t TEMP <<< $(grep -lr -e "- ${rule}\$" build/*/profiles | sort)
ALL_PROFILES+=(${TEMP[@]})
PROFILES+=(${TEMP[$(($RANDOM%(${#TEMP[@]})))]})
# 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
if [[ ${TEMP[$index]} =~ build\/.*\/profiles\/${tp}\.profile ]]; then
ELIGIBLE_PROFILES+=(${TEMP[$index]});
fi
done
done
ALL_PROFILES+=(${ELIGIBLE_PROFILES[@]})
PROFILES+=(${ELIGIBLE_PROFILES[$(($RANDOM%(${#ELIGIBLE_PROFILES[@]})))]})
done
# Sort and ensure that the profiles are unique
Expand Down

0 comments on commit 0cf1bbf

Please sign in to comment.