daml/ci/tell-slack-failed.yml
Gary Verhaegen 5f9db11663
fix tell-slack-failed CI "function" (#5670)
And here I was, thinking our builds had gotten more stable as of late.

😢

CHANGELOG_BEGIN
CHANGELOG_END
2020-04-22 15:21:04 +02:00

25 lines
1.1 KiB
YAML

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
parameters:
trigger_sha: ''
steps:
- bash: |
set -euo pipefail
COMMIT_TITLE=$(git log --pretty=format:%s -n1 ${{ parameters.trigger_sha }})
COMMIT_LINK="<https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|$COMMIT_TITLE>"
if [ -z "${{ parameters.trigger_sha }}" ]; then
WARNING="<!here> *FAILED* $(Build.SourceBranchName)/$(Agent.JobName): $COMMIT_LINK"
else
WARNING=":fire: :fire: :fire: :fire: :fire:\n<!here> *RELEASE FAILED* $(Build.SourceBranchName)/$(Agent.JobName): $COMMIT_LINK\n:fire: :fire: :fire: :fire: :fire:"
fi
curl -XPOST \
-i \
-H 'Content-type: application/json' \
--data "{\"text\":\"$WARNING\n\"}" \
$(Slack.team-daml)
condition: and(failed(),
or(eq(variables['Build.SourceBranchName'], 'master'),
startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))