aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Alfonsi <laurent.alfonsi@linaro.org>2022-08-04 09:03:34 +0200
committerLaurent Alfonsi <laurent.alfonsi@linaro.org>2022-08-04 09:39:26 +0200
commit6100f4c990b141e6b1332980c9db2a9b2741f657 (patch)
treeaabf545733fda2c9a43cf1ae382055994ebd1a52
parent9526c1fd40166ea055c66b8dc096877ff66ee60c (diff)
tcwg-check-ci-jobs-vs-yaml: improve output
Change-Id: I00cbac64e4fc19319210fbad8456cac77ede5898
-rwxr-xr-xtcwg-check-ci-jobs-vs-yaml/tcwg-check-ci-jobs-vs-yaml.sh43
1 files changed, 37 insertions, 6 deletions
diff --git a/tcwg-check-ci-jobs-vs-yaml/tcwg-check-ci-jobs-vs-yaml.sh b/tcwg-check-ci-jobs-vs-yaml/tcwg-check-ci-jobs-vs-yaml.sh
index c5b6903232..54f2d7a3be 100755
--- a/tcwg-check-ci-jobs-vs-yaml/tcwg-check-ci-jobs-vs-yaml.sh
+++ b/tcwg-check-ci-jobs-vs-yaml/tcwg-check-ci-jobs-vs-yaml.sh
@@ -2,6 +2,9 @@
set -e
+jenkinsurl=https://ci.linaro.org
+exit_status=0
+
ci_jobs=()
configs_jobs=()
@@ -34,7 +37,8 @@ done
## GET THE JOBS LIST LOOKING AT JENKINS SERVER
get_ci_jobs()
{
- echo "============== GET_CI_JOBS ==============="
+ TRACEFILE=$result_dir/check_ci_sync_debug.txt
+ echo "============== GET_CI_JOBS ===============" | tee -a $TRACEFILE
# ssh ci.linaro.org list-jobs
CMD="ssh -p2222 -l $USER@linaro.org ci.linaro.org"
@@ -42,7 +46,10 @@ get_ci_jobs()
all_ci_jobs=( $($CMD list-jobs) )
for jb in "${all_ci_jobs[@]}"; do
if [[ $jb == *$job_subset* ]]; then
+ echo " * $jb" >> $TRACEFILE
ci_jobs+=( "$jb" )
+ else
+ echo " $jb" >> $TRACEFILE
fi
done
printf " (found ${#all_ci_jobs[*]} jobs, select ${#ci_jobs[*]} jobs)\n"
@@ -57,7 +64,8 @@ get_configs_jobs()
[ -d $outdir ] && rm -rf $outdir
mkdir $outdir
- echo "============ GET_CONFIGS_JOBS ============="
+ TRACEFILE=$result_dir/check_ci_sync_debug.txt
+ echo "============ GET_CONFIGS_JOBS =============" | tee -a $TRACEFILE
# Yaml files
yaml_files=$(find $config_dir -name "*$job_subset*.yaml")
printf " (found $(echo $yaml_files | wc -w) yaml files)\n"
@@ -68,9 +76,11 @@ get_configs_jobs()
if ! jenkins-jobs test -o $outdir $fn >& $tmpfile; then
echo ""
echo "# WARNING: jenkins-job command fails"
- echo "+ jenkins-jobs test -o $outdir $fn"
+ echo " + jenkins-jobs test -o $outdir $fn # Fails" | tee -a $TRACEFILE
cat $tmpfile
configs_jobs_failing+=( "$fn" )
+ else
+ echo "+ jenkins-jobs test -o $outdir $fn" >> $TRACEFILE
fi
done
rm $tmpfile
@@ -87,9 +97,9 @@ get_configs_jobs()
# Print failing jenkins-job if any
if [ ${#configs_jobs_failing[@]} -gt 0 ]; then
- echo "# jenkins-jobs failing for file :" | tee -a $TRACEFILE
+ echo "# jenkins-jobs failing for file :" | tee -a $TRACEFILE
for fn in ${configs_jobs_failing[*]}; do
- echo " jenkins-jobs test -o $outdir $fn"
+ echo " jenkins-jobs test -o $outdir $fn" | tee -a $TRACEFILE
done
echo ""
fi
@@ -131,6 +141,10 @@ summary()
echo "JENKINS JOBS doesnot exists but the YAML FILE exist : ${#yaml_noexists_job_exists[@]} jobs" | tee -a $TRACEFILE
echo "JENKINS JOBS exists but the YAML FILE doesnot exist : ${#yaml_exists_job_noexists[@]} jobs" | tee -a $TRACEFILE
+ if [ ${#yaml_noexists_job_exists[@]} != 0 ] || [ ${#yaml_exists_job_noexists[@]} != 0 ]; then
+ exit_status=1
+ fi
+
echo " (See details in $TRACEFILE)"
echo ""
}
@@ -151,11 +165,26 @@ print_suggestions()
if [ ${#configs_jobs_failing[@]} != 0 ]; then
echo "# /!\ WARNING : some of the following orphan jobs may be due to the failing jenkins-job commands above."
fi
- echo ""
+ echo ""
for jb in "${yaml_noexists_job_exists[@]}"; do
+ echo " # $jenkinsurl/job/$jb"
echo " $CMD delete-job $jb"
done
+ echo ""
+ fi
+
+ if [ ${#yaml_exists_job_noexists[@]} != 0 ]; then
+ echo "# Some YAML FILES generates a xml, but the JENKINS JOB doesnot exist (${#yaml_noexists_job_exists[@]} jobs)"
+ echo "# --------------------------------------------------------"
+ echo "# Don't know what to do with that right now."
+ echo "# Might be due to a problem in this script."
+
+ echo ""
+ for jb in "${yaml_exists_job_noexists[@]}"; do
+ echo " $jb"
+ done
+ echo ""
fi
}
@@ -168,3 +197,5 @@ get_configs_jobs
summary
print_suggestions
+
+exit $exit_status