Skip to content

Commit 23ee673

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 23ee673

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

hack/openstack-job-audit.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
projects=$(grep -Rl vexxhost $config_base_path | rev | awk -F '/' '{print $2 "/" $3}' | rev |sort -u)
16+
17+
> "$output_file"
18+
19+
for project in ${projects[@]}; do
20+
echo "$project:" >> "$output_file"
21+
for file in $(grep -Rl vexxhost "$config_base_path/$project/" | sort -u); do
22+
yq -r "
23+
\" - \(filename):\" ,
24+
(.tests[]
25+
| select(.steps.cluster_profile | match(\".*vexxhost.*\"))
26+
| \" - \" + .as + \":\" +
27+
\"\n run_if_changed: \" + (.run_if_changed // \"null\") +
28+
\"\n skip_if_only_changed: \" + (.skip_if_only_changed // \"null\")
29+
)
30+
" "$file" >> "$output_file"
31+
done
32+
done

0 commit comments

Comments
 (0)