daml/ci/bash-lib.yml
Gary Verhaegen 51e7c88bf5
announce release rotation on Tuesday (#7151)
It's been pointed out to me that some people actually plan their work,
and for them, it would be useful to know at least a day in advance that
they will be doing a release. This PR attempts to accommodate that.

Note: this will run as a new, separate cron. I'll do the Azure setup
after this gets approved.

CHANGELOG_BEGIN
CHANGELOG_END
2020-08-17 13:42:35 +02:00

34 lines
1.3 KiB
YAML

# Copyright (c) 2020 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'
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
}
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
}
END
echo "##vso[task.setvariable variable=${{parameters.var_name}}]$TMP"