summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Alfonsi <laurent.alfonsi@linaro.org>2022-07-31 15:15:47 +0200
committerLaurent Alfonsi <laurent.alfonsi@linaro.org>2022-08-05 09:56:26 +0200
commitfd468010353eea1437be4866a4c6cf8569b7b9b0 (patch)
tree161effe228dee8a72b8450902135c5e2c05709eb
parentd422b96880233f6122d3af16f82874bc03ddc68a (diff)
tcwg-report-stale-rr-jobs.sh: add no change in sources automatic detection
Change-Id: I32c15d31b0ab3183fed80034e593ab6cc1cda6c9
-rwxr-xr-xtcwg-report-stale-rr-jobs.sh57
1 files changed, 45 insertions, 12 deletions
diff --git a/tcwg-report-stale-rr-jobs.sh b/tcwg-report-stale-rr-jobs.sh
index 67bc2ffa..032cf92c 100755
--- a/tcwg-report-stale-rr-jobs.sh
+++ b/tcwg-report-stale-rr-jobs.sh
@@ -209,16 +209,19 @@ get_project_info ()
# LastBuild run date
download_project_file lastBuild/__toppage__
test['run_date']=$(grep 'Started .* ago' lastBuild/__toppage__ | sed -e 's|.*Started \(.*\) ago.*|\1 ago|'|head -1)
- test['run_date']=$(echo ${test['run_date']} | sed -e 's|,||g' -e 's| mo | month |g' -e 's| hr | hour |g' || true)
- test['run_date']=$(date --date="${test['run_date']}" +"%x %R")
}
-get_index ()
+get_artifact_dir ()
{
lookfor=$1
- for nb in 08 09 10 11; do
- download_project_file ${test['run_nb']}/artifact/artifacts/$nb-$lookfor/__toppage__
- if [ -s ${test['run_nb']}/artifact/artifacts/$nb-$lookfor/__toppage__ ]; then
- test["run_$lookfor"]="$nb-$lookfor"
+ download_project_file ${test['run_nb']}/artifact/artifacts/__toppage__
+ local i nb stepname
+ for i in {1..15}; do
+ stepname=$(printf "%02d" $i)-$lookfor
+ nb=$(grep -c "href=\"$stepname\"" ${test['run_nb']}/artifact/artifacts/__toppage__)
+ if [ $nb != 0 ]; then
+ test["run_dir_$lookfor"]="$stepname"
+ echo "$stepname"
+ #echo "$jenkins_base_url/job/${test['jkproject']}/${test['run_nb']}/artifact/artifacts/${test[run_dir_$lookfor]}"
break
fi
done
@@ -240,7 +243,7 @@ get_run_title_and_status ()
}
get_last_interesting_run ()
{
- gitprojectshort=$(echo ${test['gitproject']}|sed -e 's|-.*||')
+ gitprojectshort=$(echo ${test['gitproject']}|cut -d- -f1)
test['last_run']="lastBuild"
get_run_title_and_status "lastBuild"
@@ -341,12 +344,41 @@ classify_analyse_result_file ()
fi
}
-
## Detection quite fragile for the moment
-classify_branch_not_updated_for_long_time ()
+classify_no_change_in_sources ()
{
- # not ready
- return;
+ local pjt days_limit
+
+ if [ ! -z "${test['diag']}" ]; then return; fi
+
+ verbose " - classify_no_change_in_sources()"
+ # how many days
+ if [[ ${test['jkproject']} =~ -release- ]]; then
+ days_limit="$((days+days))"
+ else
+ days_limit="$days"
+ fi
+
+ # get date
+ download_project_file ${test['run_nb']}/artifact/artifacts/jenkins/manifest.sh
+
+ # shellcheck disable=SC2034
+ declare -A rr debug
+ # shellcheck disable=SC1090
+ source ${test['run_nb']}/artifact/artifacts/jenkins/manifest.sh
+
+ # set diag if appopriate
+ pjt=$(echo ${test['gitproject']}|cut -d- -f1)
+ echo "if [\${debug[${pjt}_date]+abc} ]; then"
+ if [ "${debug[${pjt}_date]+abc}" ]; then
+ local last_commit_date start_warn_date
+ last_commit_date="${debug[${pjt}_date]}"
+ start_warn_date=$(date +%s --date="$days_limit days ago")
+
+ if [ "$last_commit_date" -lt "$start_warn_date" ]; then
+ set_diag "ERROR (no change in sources)";
+ fi
+ fi
}
@@ -416,6 +448,7 @@ classify_failures ()
get_last_interesting_run
classify_analyse_console
classify_analyse_result_file
+ classify_no_change_in_sources
printf "%-35s | %-13s | %-16s | %-16s | %-16s %-50s\n" "${test['diag']}" "${test['last_updated']}" "${test['poll_date']}" "${test['run_date']}" "[${test['gitproject']}]" "$jenkins_base_url/job/${test['jkproject']}/${test['run_nb']}"
done < $stale_jobs_file