summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-09-14 14:29:59 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-09-14 14:29:59 +0000
commit52b65a7cc43fdf159ef1bba101fbbc694afdc6b5 (patch)
tree40638ab8e4df990e22647efea22c1be8c75c132d
parent6a32dfbd33a6d730bad85d12e7ecd248e28aba0f (diff)
round-robin.sh: Add handling of COMMIT_* variables
... which can be used in email templates. Change-Id: I82e76e8fad5b631e12a545b8c35a1c8d85deeada
-rw-r--r--round-robin.sh48
1 files changed, 27 insertions, 21 deletions
diff --git a/round-robin.sh b/round-robin.sh
index 667689aa..1b20af14 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -623,9 +623,6 @@ check_regression ()
trigger_dest="$run_step_artifacts"
fi
- local cur_rev
- cur_rev=$(git -C $single_component rev-parse HEAD)
-
# 1. If $score is less-than 0, then the regression is not very
# interesting, so reduce down to component, but don't bisect. This
# allows non-broken components to advance their revisions.
@@ -656,6 +653,9 @@ check_regression ()
done < <(${rr[breakup_updated_components]})
elif ! [ $score -lt 0 ] 2>/dev/null; then
# Bisect failures in all steps after "-1" step.
+ local cur_rev
+ cur_rev=$(git -C $single_component rev-parse HEAD)
+
cat > $trigger_dest/trigger-bisect <<EOF
current_project=$single_component
bad_git=${rr[${single_component}_git]%#*}#$cur_rev
@@ -669,20 +669,22 @@ EOF
local mail_dir=${rr[top_artifacts]}/mail
mkdir -p $mail_dir
- if [ -f $run_step_artifacts/jira-body.txt ]; then
- cp $run_step_artifacts/jira-body.txt $mail_dir/
- else
- cat > $mail_dir/jira-body.txt <<EOF
-Identified regression caused by *$single_component* commit:
-$(git -C $single_component log --pretty=short -n 1 HEAD)
+ if ! [ -f $run_step_artifacts/mail-subject.txt ]; then
+ cat > $run_step_artifacts/mail-subject.txt <<EOF
+[TCWG CI] Regression caused by \$COMMIT_COMPONENT: \$COMMIT_SUBJECT
+EOF
+ fi
+
+ if ! [ -f $run_step_artifacts/jira-body.txt ]; then
+ cat > $run_step_artifacts/jira-body.txt <<EOF
+$(cat $run_step_artifacts/mail-subject.txt):
+\$COMMIT_LOG
EOF
fi
- if [ -f $run_step_artifacts/mail-body.txt ]; then
- cp $run_step_artifacts/mail-body.txt $mail_dir/
- else
- cat > $mail_dir/mail-body.txt <<EOF
-$(cat $mail_dir/jira-body.txt)
+ if ! [ -f $run_step_artifacts/mail-body.txt ]; then
+ cat > $run_step_artifacts/mail-body.txt <<EOF
+$(cat $run_step_artifacts/jira-body.txt)
Results regressed to
$(cat ${rr[top_artifacts]}/results)
@@ -692,13 +694,17 @@ $(cat base-artifacts/results)
EOF
fi
- if [ -f $run_step_artifacts/mail-subject.txt ]; then
- cp $run_step_artifacts/mail-subject.txt $mail_dir/
- else
- cat > $mail_dir/mail-subject.txt <<EOF
-[TCWG CI] Regression caused by $single_component:$cur_rev
-EOF
- fi
+ (
+ COMMIT_COMPONENT=$single_component
+ export COMMIT_COMPONENT
+ COMMIT_SUBJECT=$(git -C $single_component log --pretty=%s -n 1 HEAD)
+ export COMMIT_SUBJECT
+ COMMIT_LOG=$(git -C $single_component log --pretty=short -n 1 HEAD)
+ export COMMIT_LOG
+ for i in mail-subject.txt jira-body.txt mail-body.txt; do
+ envsubst < $run_step_artifacts/$i > $mail_dir/$i
+ done
+ )
fi
if [ x"${rr[update_baseline]}" = x"update" ]; then