Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test release rotation: factor out selection #11161

Merged
merged 2 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
msg=$(git log -n1 --format=%b HEAD | head -1)
# 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
pr_handler="<@$(next_in_rotation)>"
pr_handler="<@$(next_in_rotation_slack)>"
else
pr_handler=""
fi
Expand Down
8 changes: 7 additions & 1 deletion ci/bash-lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ steps:
echo "##vso[task.setvariable variable=$1;isOutput=true]$2"
}
next_in_rotation() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you choose to have a second function to select the GitHub handle, next_in_rotation_slack and next_in_rotation_github could be two viable names to avoid confusion.

awk '/^[^#]/ {print $1}' "$PROJ_DIR/release/rotation" | head -n 1
awk '/^[^#]/ {print $0}' "$PROJ_DIR/release/rotation" | head -n 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
awk '/^[^#]/ {print $0}' "$PROJ_DIR/release/rotation" | head -n 1
awk '/^[^#]/' "$PROJ_DIR/release/rotation" | head -n 1

No need to do this, it's just for you to know in case you didn't, a pattern with no corresponding action in awk will behave like {print $0}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know that. Thanks!

}
next_in_rotation_slack() {
next_in_rotation | awk '{print $1}'
}
next_in_rotation_github() {
next_in_rotation | awk '{print $2}'
}

END
Expand Down
2 changes: 1 addition & 1 deletion ci/cron/tuesday.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:

source "$(bash_lib)"

RELEASE_MANAGER=$(next_in_rotation)
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.")"
6 changes: 3 additions & 3 deletions ci/cron/wednesday.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
tmp=$(mktemp)
next=$(next_in_rotation)
grep -v "$next" release/rotation > $tmp
grep "$next" release/rotation >> $tmp
echo "$next" >> $tmp
mv $tmp release/rotation
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isolates the knowledge of comment format to the next_in_rotation function, and will not reorder comments.

}
release_message() {
Expand Down Expand Up @@ -121,8 +121,8 @@ jobs:

reset

NEXT_SLACK=$(next_in_rotation)
NEXT_GH=$(grep "$NEXT_SLACK" release/rotation | awk '{print $2}')
NEXT_SLACK=$(next_in_rotation_slack)
NEXT_GH=$(next_in_rotation_github)

PREV="v$(head -1 LATEST | awk '{print $2}')"
./release.sh new snapshot
Expand Down
2 changes: 1 addition & 1 deletion ci/prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
# 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
# the PR. Hence the `|| echo ""`.
PR_HANDLER=$(next_in_rotation)
PR_HANDLER=$(next_in_rotation_slack)

case "$(status)" in
Succeeded*)
Expand Down