daml/ci/tell-slack-failed.yml

25 lines
1.1 KiB
YAML
Raw Normal View History

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
parameters:
trigger_sha: ''
2019-07-04 17:22:22 +03:00
steps:
- bash: |
set -euo pipefail
COMMIT_TITLE=$(git log --pretty=format:%s -n1 ${{ parameters.trigger_sha }})
COMMI_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
2019-07-04 17:22:22 +03:00
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/')))