mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 00:37:23 +03:00
Request review for release rotation PR (#14287)
* Merge ci/cron/wednesday.yml open_pr function into ci/bash-lib.yml * remove unused function reset from ci/cron/wednesday.yml * Request review from current release person for rotation PR changelog_begin changelog_end
This commit is contained in:
parent
ebe7a04191
commit
6072629c7a
@ -32,27 +32,56 @@ steps:
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
open_pr() {
|
open_pr() {
|
||||||
local branch title
|
local branch title body out pr_number header output
|
||||||
branch="$1"
|
branch="$1"
|
||||||
title="$2"
|
title="$2"
|
||||||
|
body="${3:-}"
|
||||||
|
out="${4:-/dev/stdout}"
|
||||||
|
pr_number="${5:-}"
|
||||||
|
header=$(mktemp)
|
||||||
|
output=$(mktemp)
|
||||||
|
|
||||||
git branch -D $branch || true
|
git branch -D $branch || true
|
||||||
git checkout -b $branch
|
git checkout -b $branch
|
||||||
git -c user.name="Azure Pipelines Daml Build" \
|
git -c user.name="Azure Pipelines Daml Build" \
|
||||||
-c user.email="support@digitalasset.com" \
|
-c user.email="support@digitalasset.com" \
|
||||||
commit \
|
commit \
|
||||||
-m "$(printf "$title\n\nCHANGELOG_BEGIN\nCHANGELOG_END\n")"
|
-m "$(printf "$title\n\n$body\n\nCHANGELOG_BEGIN\nCHANGELOG_END\n")"
|
||||||
git push origin $branch:$branch
|
git push origin $branch:$branch
|
||||||
jq -n --arg title "$title" \
|
jq -n --arg title "$title" \
|
||||||
--arg branch "$branch" \
|
--arg branch "$branch" \
|
||||||
'{"title": $title, "head": $branch, "base": "main"}' \
|
--arg body "$(printf "$body")" \
|
||||||
|
'{"title": $title, "head": $branch, "base": "main", "body": $body}' \
|
||||||
| curl -H "Content-Type: application/json" \
|
| curl -H "Content-Type: application/json" \
|
||||||
-H "$(get_gh_auth_header)" \
|
-H "$(get_gh_auth_header)" \
|
||||||
--fail \
|
--fail \
|
||||||
--silent \
|
--silent \
|
||||||
--include \
|
|
||||||
--location \
|
--location \
|
||||||
|
--dump-header "$header" \
|
||||||
|
--output "$output" \
|
||||||
-d @- \
|
-d @- \
|
||||||
https://api.github.com/repos/digital-asset/daml/pulls
|
https://api.github.com/repos/digital-asset/daml/pulls
|
||||||
|
if [ -n "$out" ]; then
|
||||||
|
cat "$header" "$output" > "$out"
|
||||||
|
fi
|
||||||
|
if [ -n "$pr_number" ]; then
|
||||||
|
jq '.number' "$output" > "$pr_number"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
request_pr_review() {
|
||||||
|
local pr_number reviewer
|
||||||
|
pr_number="$1"
|
||||||
|
reviewer="$2"
|
||||||
|
|
||||||
|
jq -n --arg reviewer "$reviewer" \
|
||||||
|
'{"reviewers": [$reviewer]}' \
|
||||||
|
| curl -H "Content-Type: application/json" \
|
||||||
|
-H "$(get_gh_auth_header)" \
|
||||||
|
--fail \
|
||||||
|
--silent \
|
||||||
|
--location \
|
||||||
|
-d @- \
|
||||||
|
"https://api.github.com/repos/digital-asset/daml/pulls/$pr_number/requested_reviewers"
|
||||||
}
|
}
|
||||||
user_slack_handle() {
|
user_slack_handle() {
|
||||||
local email sha
|
local email sha
|
||||||
|
@ -29,51 +29,8 @@ jobs:
|
|||||||
eval "$(./dev-env/bin/dade-assist)"
|
eval "$(./dev-env/bin/dade-assist)"
|
||||||
source "$(bash_lib)"
|
source "$(bash_lib)"
|
||||||
|
|
||||||
AUTH="$(get_gh_auth_header)"
|
|
||||||
|
|
||||||
BASE_SHA=$(git rev-parse HEAD)
|
BASE_SHA=$(git rev-parse HEAD)
|
||||||
az extension add --name azure-devops
|
|
||||||
echo "$(System.AccessToken)" | az devops login --org "https://dev.azure.com/digitalasset"
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
git checkout -f $BASE_SHA
|
|
||||||
git reset --hard
|
|
||||||
}
|
|
||||||
open_pr() {
|
|
||||||
local branch title body out pr_number
|
|
||||||
branch=$1
|
|
||||||
title="$2"
|
|
||||||
body="$3"
|
|
||||||
out="${4:-}"
|
|
||||||
git branch -D $branch || true
|
|
||||||
git checkout -b $branch
|
|
||||||
git add .
|
|
||||||
git -c user.name="Azure Pipelines Daml Build" \
|
|
||||||
-c user.email="support@digitalasset.com" \
|
|
||||||
commit \
|
|
||||||
-m "$(printf "$title\n\n$body\n\nCHANGELOG_BEGIN\nCHANGELOG_END\n")"
|
|
||||||
git push origin $branch:$branch
|
|
||||||
pr_number=$(jq -n \
|
|
||||||
--arg branch "$branch" \
|
|
||||||
--arg title "$title" \
|
|
||||||
--arg body "$(printf "$body")" \
|
|
||||||
'{"title": $title, "head": $branch, "base": "main", "body": $body}' \
|
|
||||||
| curl -H "Content-Type: application/json" \
|
|
||||||
-H "$AUTH" \
|
|
||||||
--silent \
|
|
||||||
--location \
|
|
||||||
-d @- \
|
|
||||||
https://api.github.com/repos/digital-asset/daml/pulls \
|
|
||||||
| jq '.number')
|
|
||||||
az pipelines build queue \
|
|
||||||
--branch $branch \
|
|
||||||
--definition-name "PRs" \
|
|
||||||
--org "https://dev.azure.com/digitalasset" \
|
|
||||||
--project daml
|
|
||||||
if [ -n "$out" ]; then
|
|
||||||
echo $pr_number > $out
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
rotate() {
|
rotate() {
|
||||||
local tmp next
|
local tmp next
|
||||||
tmp=$(mktemp)
|
tmp=$(mktemp)
|
||||||
@ -84,8 +41,13 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
NEXT_GH=$(next_in_rotation_github)
|
NEXT_GH=$(next_in_rotation_github)
|
||||||
|
BRANCH="rotate-after-release-$(date -I)"
|
||||||
|
TITLE="rotate release duty after $(date -I)"
|
||||||
|
BODY="@$NEXT_GH is taking care of [testing](https://github.com/digital-asset/daml/blob/main/release/RELEASE.md) today's release, so they get pushed back to the end of the line.\n\nPlease do not merge this before the release is fully tested."
|
||||||
|
PR_NUMBER=$(mktemp)
|
||||||
|
|
||||||
rotate
|
rotate
|
||||||
open_pr "rotate-after-release-$(date -I)" \
|
git add .
|
||||||
"rotate release duty after $(date -I)" \
|
open_pr "$BRANCH" "$TITLE" "$BODY" "/dev/null" "$PR_NUMBER"
|
||||||
"@$NEXT_GH is taking care of [testing](https://github.com/digital-asset/daml/blob/main/release/RELEASE.md) today's release, so they get pushed back to the end of the line.\n\nPlease do not merge this before the release is fully tested."
|
trigger_azure $(System.AccessToken) "PRs" --branch $BRANCH
|
||||||
|
request_pr_review $(cat "$PR_NUMBER") "$NEXT_GH"
|
||||||
|
Loading…
Reference in New Issue
Block a user