diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-03-17 16:40:37 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-03-17 16:40:37 +0000 |
commit | 36285191e9973bf172a19d3ec93288847674dd57 (patch) | |
tree | 41ef3c2cc5bfceb08346a990b9a84291c3eabdb4 /tcwg-report-stale-rr-jobs.sh | |
parent | 4c8e3d3d30c6ae10050c3532de16c68bad594393 (diff) |
tcwg-report-stale-rr-jobs.sh: New script
... to list round-robin CI jobs that hasn't had a good run in several
days (10 days, by default). We'll use this script to monitor round-robin
jobs that are failing due to infrastructure reasons.
Change-Id: I0a76f0737903c023737c5ba9b7ff95c66b0974ac
Diffstat (limited to 'tcwg-report-stale-rr-jobs.sh')
-rwxr-xr-x | tcwg-report-stale-rr-jobs.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tcwg-report-stale-rr-jobs.sh b/tcwg-report-stale-rr-jobs.sh new file mode 100755 index 00000000..fa57fb5d --- /dev/null +++ b/tcwg-report-stale-rr-jobs.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -euf -o pipefail + +scripts=$(dirname "$0") +# shellcheck source=jenkins-helpers.sh +. "$scripts/jenkins-helpers.sh" + +convert_args_to_variables "$@" + +days="${days-10}" +refs_url="${refs_url-https://git.linaro.org/toolchain/ci/base-artifacts}" +refs_prefix="${refs_prefix-refs/heads/linaro-local/ci/}" +verbose="${verbose-false}" + +if $verbose; then + set -x +fi + +# Initialize base-artifacts repo (by cloning its "empty" branch). +refs_repo=$(basename "$refs_url" .git) +clone_or_update_repo_no_checkout "$refs_repo" "$refs_url" none empty origin >/dev/null 2>&1 +git -C "$refs_repo" reset --hard >/dev/null 2>&1 + +# Walk through all commits of all tcwg_bmk* branches and mark results +# referenced in those results with "used_by" file. +while IFS= read -r ref; do + git -C "$refs_repo" fetch -q origin "$ref" + commit_stamp=$(git -C "$refs_repo" show --no-patch --pretty=%ct FETCH_HEAD) + if [ $(($(date +%s) - $commit_stamp)) -gt $(($days * 24 * 3600)) ]; then + echo "${ref#$refs_prefix}" + fi +done < <(git ls-remote "$refs_url" "${refs_prefix}*" | awk '{ print $2 }') |