Skip to content

Commit 7c735ee

Browse files
committed
Add job audit script
Add job audit script to create a yaml showcasing conditions for the job to run from config
1 parent 8c10ef8 commit 7c735ee

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

hack/openstack-job-audit.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
#
3+
# Audits CI configuration files to find OpenStack e2e test jobs and reports
4+
# their run_if_changed and skip_if_only_changed settings.
5+
#
6+
# Usage: ./openstack-job-audit.sh <config_base_path> [output_file]
7+
# config_base_path: Path to ci-operator/config directory
8+
# output_file: Output file path (default: ./report.yaml)
9+
#
10+
# Example: ./openstack-job-audit.sh ci-operator/config ./report.yaml
11+
12+
config_base_path=$1
13+
output_file=${2:-./report.yaml}
14+
15+
jobs=(
16+
"openshift-e2e-openstack-additional-ipv6-network"
17+
"openshift-e2e-openstack-dualstack"
18+
"openshift-e2e-openstack-dualstack-upi"
19+
"openshift-e2e-openstack-dualstack-v6primary"
20+
"openshift-e2e-openstack-dualstack-techpreview"
21+
"openshift-e2e-openstack-singlestackv6"
22+
"openshift-e2e-openstack-proxy"
23+
"openshift-e2e-openstack-csi-cinder"
24+
"openshift-e2e-openstack-csi-manila"
25+
"openshift-e2e-openstack-externallb"
26+
"openshift-e2e-openstack-ccpmso-zone"
27+
"openshift-e2e-openstack-proxy"
28+
"openshift-e2e-openstack-csi-cinder"
29+
"openshift-e2e-openstack-csi-manila"
30+
"openshift-e2e-openstack-externallb"
31+
"openshift-e2e-openstack-ingress-perf"
32+
"openshift-e2e-openstack-network-perf"
33+
"openshift-e2e-openstack"
34+
)
35+
36+
37+
joined=$(IFS='|'; echo "${jobs[*]}")
38+
39+
projects=$(grep -RlE \"$joined\" $config_base_path | rev | awk -F '/' '{print $2 "/" $3}' | rev |sort -u)
40+
41+
> "$output_file"
42+
43+
for project in ${projects[@]}; do
44+
echo "$project:" >> "$output_file"
45+
for file in $(grep -REl "$joined" "$config_base_path/$project/" | sort -u); do
46+
yq -r "
47+
\" - \(filename):\" ,
48+
(.tests[]
49+
| select(.steps.workflow | test(\"$joined\"))
50+
| \" - \" + .as + \":\" +
51+
\"\n run_if_changed: \" + (.run_if_changed // \"null\") +
52+
\"\n skip_if_only_changed: \" + (.skip_if_only_changed // \"null\")
53+
)
54+
" "$file" >> "$output_file"
55+
done
56+
done

0 commit comments

Comments
 (0)