summaryrefslogtreecommitdiff
path: root/tcwg-report-stale-rr-jobs.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-03-19 13:41:30 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-03-19 13:46:23 +0000
commit4a8c969f2988248ca3fcc58d3b3d49bc949ff47e (patch)
tree6dabda3e536eb717001e1f1ab939196f5a4b9fe5 /tcwg-report-stale-rr-jobs.sh
parent33523ef39ccb53dc483f704f0cef46bb593b8787 (diff)
tcwg-report-stale-rr-jobs.sh: Add --human true/false option
... to fine-tune output format. Change-Id: I12991b14093e96a6029d3433df410567e0c12951
Diffstat (limited to 'tcwg-report-stale-rr-jobs.sh')
-rwxr-xr-xtcwg-report-stale-rr-jobs.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/tcwg-report-stale-rr-jobs.sh b/tcwg-report-stale-rr-jobs.sh
index 2dd75f55..6e0a7c08 100755
--- a/tcwg-report-stale-rr-jobs.sh
+++ b/tcwg-report-stale-rr-jobs.sh
@@ -9,8 +9,9 @@ scripts=$(dirname "$0")
convert_args_to_variables "$@"
days="${days-10}"
-refs_url="${refs_url-https://git.linaro.org/toolchain/ci/base-artifacts}"
+human="${human-true}"
refs_prefix="${refs_prefix-refs/heads/linaro-local/ci/}"
+refs_url="${refs_url-https://git.linaro.org/toolchain/ci/base-artifacts}"
verbose="${verbose-false}"
if $verbose; then
@@ -19,7 +20,8 @@ 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
+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
@@ -29,6 +31,10 @@ while IFS= read -r ref; do
commit_stamp=$(git -C "$refs_repo" show --no-patch --pretty=%ct FETCH_HEAD)
days_ago=$((($(date +%s) - $commit_stamp) / (24 * 3600)))
if [ $days_ago -gt $days ]; then
- echo "${ref#$refs_prefix} : last updated $days_ago days ago"
+ if $human; then
+ echo "${ref#$refs_prefix} : last updated $days_ago days ago"
+ else
+ echo "$ref"
+ fi
fi
done < <(git ls-remote "$refs_url" "${refs_prefix}*" | awk '{ print $2 }')