2022-01-03 19:36:51 +03:00
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2020-07-24 19:40:11 +03:00
# SPDX-License-Identifier: Apache-2.0
pr : none
trigger : none
schedules :
- cron : "0 6 * * Wed"
displayName : weekly snapshot
branches :
include :
2020-12-27 16:19:07 +03:00
- main
2020-07-24 19:40:11 +03:00
always : true
jobs :
- job : open_release_pr
timeoutInMinutes : 60
pool :
2022-02-14 04:49:38 +03:00
name : 'ubuntu_20_04'
demands : assignment -equals default
2020-07-24 19:40:11 +03:00
steps :
- checkout : self
persistCredentials : true
2020-08-14 12:35:57 +03:00
- template : ../bash-lib.yml
parameters :
var_name : bash_lib
2020-07-24 19:40:11 +03:00
- bash : |
set -euo pipefail
2022-02-14 04:49:38 +03:00
eval "$(./dev-env/bin/dade-assist)"
2020-08-14 12:35:57 +03:00
source "$(bash_lib)"
AUTH="$(get_gh_auth_header)"
2020-08-05 19:58:56 +03:00
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"
2020-08-12 11:50:28 +03:00
out="${4:-}"
2020-08-05 19:58:56 +03:00
git branch -D $branch || true
git checkout -b $branch
git add .
2021-10-07 00:08:11 +03:00
git -c user.name="Azure Pipelines Daml Build" \
2020-08-05 19:58:56 +03:00
-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")" \
2020-12-27 16:19:07 +03:00
'{"title": $title, "head": $branch, "base": "main", "body": $body}' \
2020-08-05 19:58:56 +03:00
| 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 \
2021-01-13 14:30:17 +03:00
--definition-name "PRs" \
2020-08-05 19:58:56 +03:00
--org "https://dev.azure.com/digitalasset" \
--project daml
if [ -n "$out" ]; then
echo $pr_number > $out
fi
}
rotate() {
2021-10-07 15:46:55 +03:00
local tmp next
tmp=$(mktemp)
next=$(next_in_rotation)
grep -v "$next" release/rotation > $tmp
echo "$next" >> $tmp
mv $tmp release/rotation
2020-08-03 17:42:00 +03:00
}
2021-10-07 15:46:55 +03:00
NEXT_GH=$(next_in_rotation_github)
2020-07-24 19:40:11 +03:00
2020-08-05 19:58:56 +03:00
rotate
2022-02-08 20:57:23 +03:00
open_pr "rotate-after-release-$(date -I)" \
"rotate release duty after $(date -I)" \
"@$NEXT_GH is taking care of testing 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."