Commit ed506e7d authored by Robert Speicher's avatar Robert Speicher

Require username parameter in scripts/slack

parent 358299a8
...@@ -21,7 +21,7 @@ notify-update-gitaly: ...@@ -21,7 +21,7 @@ notify-update-gitaly:
script: script:
- echo "NOTIFY_CHANNEL is ${NOTIFY_CHANNEL}" - echo "NOTIFY_CHANNEL is ${NOTIFY_CHANNEL}"
- echo "CI_PIPELINE_URL is ${CI_PIPELINE_URL}" - echo "CI_PIPELINE_URL is ${CI_PIPELINE_URL}"
- scripts/slack ${NOTIFY_CHANNEL} "☠️ \`${GITALY_UPDATE_BRANCH}\` failed! ☠️ See ${CI_PIPELINE_URL} (triggered from ${MERGE_REQUEST_URL})" ci_failing - scripts/slack ${NOTIFY_CHANNEL} "☠️ \`${GITALY_UPDATE_BRANCH}\` failed! ☠️ See ${CI_PIPELINE_URL} (triggered from ${MERGE_REQUEST_URL})" ci_failing "GitLab QA Bot"
notify-security-pipeline: notify-security-pipeline:
extends: extends:
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
CHANNEL=$1 CHANNEL=$1
MSG=$2 MSG=$2
ICON_EMOJI=$3 ICON_EMOJI=$3
USERNAME=${4:-"GitLab QA Bot"} USERNAME=$4
if [ -z "$CHANNEL" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ] || [ -z "$MSG" ] || [ -z "$ICON_EMOJI" ]; then if [ -z "$CHANNEL" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ] || [ -z "$MSG" ] || [ -z "$ICON_EMOJI" ] || [ -z "$USERNAME" ]; then
echo "Missing argument(s) - Use: $0 channel message icon_emoji [username]" echo "Missing argument(s) - Use: $0 channel message icon_emoji username"
echo "and set CI_SLACK_WEBHOOK_URL environment variable." echo "and set CI_SLACK_WEBHOOK_URL environment variable."
else else
curl -X POST --data-urlencode 'payload={"channel": "#'"$CHANNEL"'", "username": "'"$USERNAME"'", "text": "'"$MSG"'", "icon_emoji": "'":$ICON_EMOJI:"'"}' "$CI_SLACK_WEBHOOK_URL" curl -X POST --data-urlencode 'payload={"channel": "#'"$CHANNEL"'", "username": "'"$USERNAME"'", "text": "'"$MSG"'", "icon_emoji": "'":$ICON_EMOJI:"'"}' "$CI_SLACK_WEBHOOK_URL"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment