summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-09-10 13:37:19 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-09-10 13:37:19 +0000
commitc9f15da135992913d48e353ffd59d1a78a82c4b5 (patch)
treec60745be20b764e7fd6281af6c8be3b609d4d719
parent645c96436cbef9ee42ba5c39a37d32345bc77198 (diff)
downloadjenkins-scripts-c9f15da135992913d48e353ffd59d1a78a82c4b5.tar.gz
round-robin-bisect.sh: Use .draft files for email generation
Change-Id: I34c98cdaaf55e711f8421e8e15e59c50374dc28c
-rwxr-xr-xround-robin-bisect.sh29
1 files changed, 22 insertions, 7 deletions
diff --git a/round-robin-bisect.sh b/round-robin-bisect.sh
index 3008b649..258b4666 100755
--- a/round-robin-bisect.sh
+++ b/round-robin-bisect.sh
@@ -648,9 +648,6 @@ case "${rr[ci_project]}" in
;;
esac
-# Remove any fail-safe email body
-rm -f $artifacts/jenkins/mail-body.txt
-
if $notify_devs; then
occurences="$(cat $current_project/$interesting_commits/$current_project | grep "^$first_bad" | sed -e "s/^$first_bad *//" | tr ' ' '\n' | sed "s#^# - #")"
if [ "$(echo "$occurences" | wc -l)" -le 1 ]; then
@@ -675,6 +672,8 @@ if $notify_devs; then
*) jira_card="GNU-692" ;;
esac
+ rm -f $artifacts/jenkins/mail-body.draft
+
if [ x"${TCWG_JIRA_TOKEN+set}" = x"set" ] && [ x"$jira_card" != x"" ]; then
cat > $artifacts/jenkins/jira-body.txt <<EOF
[$jira_card]
@@ -700,12 +699,14 @@ EOF
echo y | jipdate.py -f $artifacts/jenkins/jira-body.txt &
res=0 && wait $! || res=$?
if [ $res != 0 ]; then
- echo "WARNING: Could not post this report to $jira_card" \
- >> $artifacts/jenkins/mail-body.txt
+ cat >> $artifacts/jenkins/mail-body.draft <<EOF
+WARNING: Could not post this report to $jira_card
+
+EOF
fi
fi
- cat >> $artifacts/jenkins/mail-body.txt <<EOF
+ cat >> $artifacts/jenkins/mail-body.draft <<EOF
Identified regression caused by *$current_project:$first_bad*:
$(git -C $current_project log --pretty=short -n 1 $first_bad)
@@ -763,6 +764,10 @@ $(git -C $current_project show --stat --patch $first_bad | head -n 1000)
</cut>
EOF
+ cat > $artifacts/jenkins/mail-subject.draft <<EOF
+[TCWG CI] Regression caused by $current_project:$first_bad
+EOF
+
# Set mail recipients last to preserve catch-error value from .yaml file.
# Email developers.
CI_MAIL_RECIPIENTS=("bcc:tcwg-validation@linaro.org")
@@ -804,12 +809,22 @@ EOF
(
IFS=","
- cat > $artifacts/jenkins/mail-recipients.txt <<EOF
+ cat > $artifacts/jenkins/mail-recipients.draft <<EOF
${CI_MAIL_RECIPIENTS[*]}
EOF
)
+
+ mv $artifacts/jenkins/mail-recipients.draft \
+ $artifacts/jenkins/mail-recipients.txt
+ mv $artifacts/jenkins/mail-subject.draft \
+ $artifacts/jenkins/mail-subject.txt
+ mv $artifacts/jenkins/mail-body.draft \
+ $artifacts/jenkins/mail-body.txt
else
+ # Remove any fail-safe email stubs
echo > $artifacts/jenkins/mail-recipients.txt
+ echo > $artifacts/jenkins/mail-subject.txt
+ echo > $artifacts/jenkins/mail-body.txt
fi
trap "" EXIT