mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-08 21:34:22 +03:00
Fix slack escaping (#8311)
The previous escaping syntax doesn’t seem to work (after the first layer you no longer have a variable) and has broken our build reporting completely. changelog_begin changelog_end
This commit is contained in:
parent
1f048af9d8
commit
fbf1820f94
@ -9,6 +9,14 @@ steps:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
TMP=$(mktemp)
|
TMP=$(mktemp)
|
||||||
cat > $TMP <<'END'
|
cat > $TMP <<'END'
|
||||||
|
escape_slack() {
|
||||||
|
local r
|
||||||
|
r="$1"
|
||||||
|
r="${r//&/&}"
|
||||||
|
r="${r//>/>}"
|
||||||
|
r="${r//</<}"
|
||||||
|
echo "$r"
|
||||||
|
}
|
||||||
get_gh_auth_header() {
|
get_gh_auth_header() {
|
||||||
# Credentials are persisted in a different way on GCP and Azure nodes.
|
# 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
|
if header=$(git config 'http.https://github.com/digital-asset/daml.extraheader'); then
|
||||||
|
@ -5,11 +5,15 @@ parameters:
|
|||||||
success-message: '\"$(Agent.JobName) passed: $COMMIT_LINK\"'
|
success-message: '\"$(Agent.JobName) passed: $COMMIT_LINK\"'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- template: bash-lib.yml
|
||||||
|
parameters:
|
||||||
|
var_name: bash_lib
|
||||||
- bash: |
|
- bash: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
eval "$(dev-env/bin/dade assist)"
|
eval "$(dev-env/bin/dade assist)"
|
||||||
COMMIT_TITLE=$(git log --pretty=format:%s -n1)
|
source $(bash_lib)
|
||||||
COMMIT_LINK="<https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|${${${COMMIT_TITLE//&/&}//>/>}//</<}>"
|
COMMIT_TITLE="$(escape_slack $(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 [ "$(Agent.JobStatus)" != "Succeeded" ]; then
|
if [ "$(Agent.JobStatus)" != "Succeeded" ]; then
|
||||||
MESSAGE="\":fire: :fire: <!here> :fire: :fire:\n$(Agent.JobName) *FAILED*: $COMMIT_LINK\n:fire: :fire:\""
|
MESSAGE="\":fire: :fire: <!here> :fire: :fire:\n$(Agent.JobName) *FAILED*: $COMMIT_LINK\n:fire: :fire:\""
|
||||||
else
|
else
|
||||||
|
@ -5,10 +5,14 @@ parameters:
|
|||||||
trigger_sha: ''
|
trigger_sha: ''
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- template: bash-lib.yml
|
||||||
|
parameters:
|
||||||
|
var_name: bash_lib
|
||||||
- bash: |
|
- bash: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
COMMIT_TITLE=$(git log --pretty=format:%s -n1 ${{ parameters.trigger_sha }})
|
source $(bash_lib)
|
||||||
COMMIT_LINK="<https://dev.azure.com/digitalasset/daml/_build/results?buildId=$(Build.BuildId)|${${${COMMIT_TITLE//&/&}//>/>}//</<}>"
|
COMMIT_TITLE="$(escape_slack $(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
|
if [ -z "${{ parameters.trigger_sha }}" ]; then
|
||||||
WARNING="<!here> *FAILED* $(Build.SourceBranchName)/$(Agent.JobName): $COMMIT_LINK"
|
WARNING="<!here> *FAILED* $(Build.SourceBranchName)/$(Agent.JobName): $COMMIT_LINK"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user