2021-01-01 21:49:51 +03:00
|
|
|
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
2020-06-03 17:36:05 +03:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
parameters:
|
2020-06-09 09:45:58 +03:00
|
|
|
success-message: '\"$(Agent.JobName) passed: $COMMIT_LINK\"'
|
2020-06-03 17:36:05 +03:00
|
|
|
|
|
|
|
steps:
|
2020-12-16 14:18:41 +03:00
|
|
|
- template: bash-lib.yml
|
|
|
|
parameters:
|
|
|
|
var_name: bash_lib
|
2020-06-03 17:36:05 +03:00
|
|
|
- bash: |
|
|
|
|
set -euo pipefail
|
|
|
|
eval "$(dev-env/bin/dade assist)"
|
2020-12-16 14:18:41 +03:00
|
|
|
source $(bash_lib)
|
2020-12-17 16:32:49 +03:00
|
|
|
COMMIT_TITLE="$(escape_slack "$(git log --pretty=format:%s -n1 ${{ parameters.trigger_sha }})")"
|
2020-12-16 14:18:41 +03:00
|
|
|
COMMIT_LINK="<https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|${COMMIT_TITLE}>"
|
2020-06-03 17:36:05 +03:00
|
|
|
if [ "$(Agent.JobStatus)" != "Succeeded" ]; then
|
2020-06-14 23:52:57 +03:00
|
|
|
MESSAGE="\":fire: :fire: <!here> :fire: :fire:\n$(Agent.JobName) *FAILED*: $COMMIT_LINK\n:fire: :fire:\""
|
2020-06-03 17:36:05 +03:00
|
|
|
else
|
2020-06-09 09:45:58 +03:00
|
|
|
MESSAGE="${{ parameters['success-message'] }}"
|
2020-06-03 17:36:05 +03:00
|
|
|
fi
|
2020-06-09 09:45:58 +03:00
|
|
|
PAYLOAD="{\"text\":$MESSAGE}"
|
2020-12-27 16:19:07 +03:00
|
|
|
if [ "$(Build.SourceBranchName)" = "main" ]; then
|
2020-06-03 17:36:05 +03:00
|
|
|
curl -XPOST \
|
|
|
|
-i \
|
|
|
|
-H 'Content-type: application/json' \
|
|
|
|
--data "$PAYLOAD" \
|
|
|
|
$(Slack.team-daml)
|
|
|
|
fi
|
|
|
|
displayName: report
|
|
|
|
condition: always()
|