mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-11 04:45:57 +03:00
On the last release, the job succeeded despite no being able to create the compat PR. This fixes: - The curl call to actually return non-0 on non-2xx HTTP response. - The way in which we encode the credentials. This also attempts to create a Bash library, hopefully this time in a way that doesn't get destroyed by our release process. IIUC pipeline instructions (YAML files) are all parsed and read before any execution, so by embedding the Bash library in a template we should get the correct version (i.e. the one that is running the pipeline) even when checking out other commits. CHANGELOG_BEGIN CHANGELOG_END
27 lines
1.0 KiB
YAML
27 lines
1.0 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
|
|
}
|
|
END
|
|
echo "##vso[task.setvariable variable=${{parameters.var_name}}]$TMP"
|