Browse Source

Change echo to evaluate newline in text property, unify echo usage

master
Michael Both 5 years ago
parent
commit
6b122c9ccc
  1. 20
      bin/out

20
bin/out

@ -60,7 +60,7 @@ if [[ "$always_notify" == "true" || -n "$TEXT_FILE_CONTENT" || -z "$text_file" |
then
export TEXT_FILE_CONTENT="${TEXT_FILE_CONTENT:-_(text_file not provided)_}"
text=$(echo -n "${text}" | envsubst)
text=$(echo -en "${text}" | envsubst)
[[ -z "${text}" ]] && text="_(missing notification text)_"
[ "${link}" == "true" ] && formatted_body="<a href=\"$ATC_EXTERNAL_URL/teams/${team}/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME\">${text}</a>"
@ -71,10 +71,10 @@ then
fi
text=$(echo -n "${text}" | jq -R -s .)
[ -n "${formatted_body}" ] && formatted_body="$(echo -n "${formatted_body}" | jq -R -s .)"
[ -n "${formatted_body}" ] && formatted_body=$(echo -n "${formatted_body}" | jq -R -s .)
[[ "${token}" != "null" ]] && username="$(echo "$token" | envsubst | jq -R -s .)"
[[ "${room_id}" != "null" ]] && room_id="$(echo "$room_id" | envsubst | jq -R -s .)"
[[ "${token}" != "null" ]] && username=$(echo "$token" | envsubst | jq -R -s .)
[[ "${room_id}" != "null" ]] && room_id=$(echo "$room_id" | envsubst | jq -R -s .)
body="$(cat <<EOF
{
"msgtype": "${msgtype}",
@ -95,20 +95,20 @@ EOF
}
EOF
)"
body=$(echo -n $body | jq -c ".build=$builddata")
body=$(echo -n "$body" | jq -c ".build=$builddata")
if [ -n "${formatted_body}" ]; then
body=$(echo -n $body | jq -c ".formatted_body=$formatted_body")
body=$(echo -n $body | jq -c ".format=\"org.matrix.custom.html\"")
body=$(echo -n "$body" | jq -c ".formatted_body=$formatted_body")
body=$(echo -n "$body" | jq -c ".format=\"org.matrix.custom.html\"")
fi
if [ -n "$DATA_FILE_CONTENT" ]; then
body=$(echo -n $body | jq -c ".data=$DATA_FILE_CONTENT")
body=$(echo -n "$body" | jq -c ".data=$DATA_FILE_CONTENT")
fi
if [ -n "${trigger}" ]; then
body=$(echo -n $body | jq -c ".trigger=\"${trigger}\"")
body=$(echo -n "$body" | jq -c ".trigger=\"${trigger}\"")
fi
# fi
compact_body="$(echo -n "${body}" | jq -c '.')"
compact_body=$(echo -n "${body}" | jq -c '.')
if [[ "$silent" == "true" ]]
then

Loading…
Cancel
Save