mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-11 04:45:57 +03:00
I _believe_ this is what has been tripping up the check-releses job for the past few days: while updating the signing key, I did not update the key fingerprint to match, and therefore trying to check any signature fails. The failure mode of the existing script is still pretty bad, regadless: looping on the same release until the hard drive is full is definitely not expected. Our retry policies are supposed to have time bounds, and failure should result in cleaning up the workdir. run-full-compat: true
256 lines
11 KiB
YAML
256 lines
11 KiB
YAML
# Copyright (c) 2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
parameters:
|
|
var_name: ""
|
|
|
|
steps:
|
|
- bash: |
|
|
set -euo pipefail
|
|
TMP=$(mktemp)
|
|
cat > "$TMP" <<'END'
|
|
PROJ_DIR="$PWD"
|
|
escape_slack() {
|
|
local r
|
|
r="$1"
|
|
r="${r//&/&}"
|
|
r="${r//>/>}"
|
|
r="${r//</<}"
|
|
echo "$r"
|
|
}
|
|
get_gh_auth_header() {
|
|
# Credentials are persisted in a different way on GCP and Azure nodes.
|
|
if header=$(git config 'http.https://github.com/digital-asset/daml.extraheader'); then
|
|
# On Azure nodes, the auth header is stored directly in the git
|
|
# config.
|
|
echo $header
|
|
else
|
|
# On GCP nodes, the credentials are stored as part of the remote
|
|
# url instead of as a separate header. The format is
|
|
# https://username:password@github.com/:user/:repo.git
|
|
echo "Authorization: basic $(git config remote.origin.url | grep -o '://.*:.*@' | cut -c4- | rev | cut -c2- | rev | tr -d '\n' | base64 -w0)"
|
|
fi
|
|
}
|
|
open_pr() {
|
|
local branch title body pr_number header output
|
|
branch="$1"
|
|
title="$2"
|
|
body="${3:-}"
|
|
pr_number="${4:-}"
|
|
header=$(mktemp)
|
|
output=$(mktemp)
|
|
|
|
git branch -D $branch || true
|
|
git checkout -b $branch
|
|
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
|
|
jq -n --arg title "$title" \
|
|
--arg branch "$branch" \
|
|
--arg body "$(printf "$body")" \
|
|
'{"title": $title, "head": $branch, "base": "main", "body": $body}' \
|
|
| curl -H "Content-Type: application/json" \
|
|
-H "$(get_gh_auth_header)" \
|
|
--fail \
|
|
--silent \
|
|
--location \
|
|
--dump-header "$header" \
|
|
--output "$output" \
|
|
-d @- \
|
|
https://api.github.com/repos/digital-asset/daml/pulls
|
|
cat "$header" "$output"
|
|
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() {
|
|
local email sha
|
|
sha=$1
|
|
email=$(git log -n 1 --format=%ae $sha)
|
|
if cat ci/slack_user_ids | grep $email >/dev/null 2>&1; then
|
|
echo $(cat ci/slack_user_ids | grep $email | awk '{print $2}')
|
|
else
|
|
echo ""
|
|
fi
|
|
}
|
|
tell_slack() {
|
|
local message channel
|
|
message="$1"
|
|
channel=${2:-$(Slack.team-daml)}
|
|
jq -n --arg message "$message" '{"text": $message}' \
|
|
| curl -XPOST -i -H 'Content-Type: application/json' -d @- $channel
|
|
}
|
|
wrap_gcloud() (
|
|
cred="$1"
|
|
cmd="$2"
|
|
key=$(mktemp)
|
|
config_dir=$(mktemp -d)
|
|
trap "rm -rf $key $config_dir" EXIT
|
|
echo "$cred" > $key
|
|
export CLOUDSDK_CONFIG="$config_dir"
|
|
export BOTO_CONFIG=/dev/null
|
|
gcloud auth activate-service-account --key-file=$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N/0JsCuG4uAztAfU9hjbLmSxpjf04Qqpc5NDlGLgZ2xQTVmXPlFg1DgrF6fIq
|
|
WZwPa7z1eihkrEERPjnisjuwMd4uO5BIkqh8F7HdOnARYXpftg9LReV973z7i8n9
|
|
4rhpBedAHwVRqWo8owM8DOVTaHAQzMnnzB+6nCoOcZc7PzhWtKKhZupW2DYaLdIh
|
|
nlVCrmMSozkFn3shtOJ76XF2DMDpk0353w6i6rKghWC7TdpXPnWkHkExw4Pjnlse
|
|
1NP2vdz183NKqEKros463i+hOszQj7jb5DiFxxOnKUfxBNEMJXTqYzXdEzw7Sncw
|
|
NwTv4pFxnk3XFJD3IIXMdaCDYmHIJYK5Fwgc0Cop3dRAMJIB+0Q1/p+urDXqZphq
|
|
AGroZ22Z1DXzv7rm1x2drZyOBohc+dqn3zjEx+lwZ6CY8XPiQgbWEzSzY8YT4oUA
|
|
xRcs9cJ+0SK/HhW/EG51YNbr5IMDb3HvycHEreszEvwq2HdnsMIYdM8GC7fl7Zpp
|
|
0r+S1089BYMqKmhepps=
|
|
=srz3
|
|
-----END PGP PUBLIC KEY BLOCK-----
|
|
PUB_KEY
|
|
gpg_dir=$(mktemp -d)
|
|
GNUPGHOME=$gpg_dir gpg --no-tty --quiet --import $key
|
|
GNUPGHOME=$gpg_dir gpg --no-tty --quiet --command-fd 0 --edit-key F26D8A0AADF666CCB28F2AB1650EC3253B6A8FF5 << CMD
|
|
trust
|
|
4
|
|
quit
|
|
CMD
|
|
GNUPGHOME=$gpg_dir gpg --verify $signature_file
|
|
res=$?
|
|
rm -rf $gpg_dir $key
|
|
return $res
|
|
}
|
|
setvar() {
|
|
echo "Setting '$1' to '$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}'
|
|
}
|
|
trigger_azure() (
|
|
token=$1
|
|
shift
|
|
build=$1
|
|
shift
|
|
az extension add --name azure-devops
|
|
trap 'az devops logout' EXIT
|
|
echo $token \
|
|
| az devops login --org "https://dev.azure.com/digitalasset"
|
|
az pipelines build queue \
|
|
--definition-name $build \
|
|
--org "https://dev.azure.com/digitalasset" \
|
|
--project daml \
|
|
$@
|
|
)
|
|
|
|
END
|
|
echo "##vso[task.setvariable variable=${{parameters.var_name}}]$TMP"
|
|
displayName: install Bash lib
|
|
condition: always()
|