test release rotation: factor out selection (#11161)

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Gary Verhaegen 2021-10-07 14:46:55 +02:00 committed by GitHub
parent dd233ef155
commit fcd4549569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 13 deletions

View File

@ -131,10 +131,11 @@ jobs:
condition: and(succeeded(), not(eq(variables['skip-github'], 'TRUE'))) condition: and(succeeded(), not(eq(variables['skip-github'], 'TRUE')))
- bash: | - bash: |
set -euo pipefail set -euo pipefail
source $(bash-lib)
msg=$(git log -n1 --format=%b HEAD | head -1) msg=$(git log -n1 --format=%b HEAD | head -1)
# Keep this line in sync with RELEASE_PR_NOTIF in ci/cron/wednesday.yml # Keep this line in sync with RELEASE_PR_NOTIF in ci/cron/wednesday.yml
if [ "$msg" = "This PR has been created by a script, which is not very smart" ]; then if [ "$msg" = "This PR has been created by a script, which is not very smart" ]; then
pr_handler="<@$(awk '/^[^#]/ {print $1}' release/rotation | head -n 1)>" pr_handler="<@$(next_in_rotation_slack)>"
else else
pr_handler="" pr_handler=""
fi fi

View File

@ -8,6 +8,7 @@ steps:
- bash: | - bash: |
set -euo pipefail set -euo pipefail
TMP=$(mktemp) TMP=$(mktemp)
PROJ_DIR="$(pwd)"
cat > $TMP <<'END' cat > $TMP <<'END'
escape_slack() { escape_slack() {
local r local r
@ -148,6 +149,15 @@ steps:
echo "Setting '$1' to '$2'" echo "Setting '$1' to '$2'"
echo "##vso[task.setvariable variable=$1;isOutput=true]$2" echo "##vso[task.setvariable variable=$1;isOutput=true]$2"
} }
next_in_rotation() {
awk '/^[^#]/ {print $0}' "$PROJ_DIR/release/rotation" | head -n 1
}
next_in_rotation_slack() {
next_in_rotation | awk '{print $1}'
}
next_in_rotation_github() {
next_in_rotation | awk '{print $2}'
}
END END
echo "##vso[task.setvariable variable=${{parameters.var_name}}]$TMP" echo "##vso[task.setvariable variable=${{parameters.var_name}}]$TMP"

View File

@ -28,6 +28,6 @@ jobs:
source "$(bash_lib)" source "$(bash_lib)"
RELEASE_MANAGER=$(awk '/^[^#]/ {print $1}' release/rotation | head -n 1) RELEASE_MANAGER=$(next_in_rotation_slack)
tell_slack "$(echo -e "Hi <@$RELEASE_MANAGER>! According to the <https://github.com/digital-asset/daml/blob/main/release/rotation|rotation>, you are in charge of the release tomorrow. Please make sure you plan accordingly, or find a replacement.\n\nIf anyone knows of any reason to delay or block the release (e.g. a PR that needs to get merged first), please make it known in thread before EOD.")" tell_slack "$(echo -e "Hi <@$RELEASE_MANAGER>! According to the <https://github.com/digital-asset/daml/blob/main/release/rotation|rotation>, you are in charge of the release tomorrow. Please make sure you plan accordingly, or find a replacement.\n\nIf anyone knows of any reason to delay or block the release (e.g. a PR that needs to get merged first), please make it known in thread before EOD.")"

View File

@ -88,14 +88,12 @@ jobs:
# labels, PRs are issues as far as the GH API is concerned. # labels, PRs are issues as far as the GH API is concerned.
} }
rotate() { rotate() {
# limitation: comments in the middle of the rotation will be hoisted to the top local tmp next
local comments rotation tmp=$(mktemp)
comments=$(mktemp) next=$(next_in_rotation)
rotation=$(mktemp) grep -v "$next" release/rotation > $tmp
awk '/^#/' release/rotation > $comments echo "$next" >> $tmp
awk '/^[^#]/' release/rotation > $rotation mv $tmp release/rotation
cp $comments release/rotation
(tail -n +2 $rotation; head -1 $rotation) >> release/rotation
} }
release_message() { release_message() {
local handler=$1 local handler=$1
@ -123,8 +121,8 @@ jobs:
reset reset
NEXT_SLACK=$(awk '/^[^#]/ {print $1}' release/rotation | head -n 1) NEXT_SLACK=$(next_in_rotation_slack)
NEXT_GH=$(awk '/^[^#]/ {print $2}' release/rotation | head -n 1) NEXT_GH=$(next_in_rotation_github)
PREV="v$(head -1 LATEST | awk '{print $2}')" PREV="v$(head -1 LATEST | awk '{print $2}')"
./release.sh new snapshot ./release.sh new snapshot

View File

@ -123,7 +123,7 @@ jobs:
# API, there is still value in getting the notification on Slack, as # API, there is still value in getting the notification on Slack, as
# we do have the build number and from there we can click through to # we do have the build number and from there we can click through to
# the PR. Hence the `|| echo ""`. # the PR. Hence the `|| echo ""`.
PR_HANDLER=$(awk '/^[^#]/ {print $1}' release/rotation | head -n 1) PR_HANDLER=$(next_in_rotation_slack)
case "$(status)" in case "$(status)" in
Succeeded*) Succeeded*)