68 lines
2.7 KiB
YAML
68 lines
2.7 KiB
YAML
.notify-defaults:
|
|
stage: notify
|
|
dependencies: []
|
|
cache: {}
|
|
|
|
.notify-slack:
|
|
extends:
|
|
- .notify-defaults
|
|
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine/curl
|
|
variables:
|
|
MERGE_REQUEST_URL: ${CI_MERGE_REQUEST_PROJECT_URL}/-/merge_requests/${CI_MERGE_REQUEST_IID}
|
|
before_script:
|
|
- apk update && apk add git bash
|
|
- echo "NOTIFY_CHANNEL is ${NOTIFY_CHANNEL}"
|
|
- echo "CI_PIPELINE_URL is ${CI_PIPELINE_URL}"
|
|
|
|
notify-update-gitaly:
|
|
extends:
|
|
- .notify-slack
|
|
rules:
|
|
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == $GITALY_UPDATE_BRANCH'
|
|
when: on_failure
|
|
allow_failure: true
|
|
variables:
|
|
NOTIFY_CHANNEL: g_gitaly
|
|
GITALY_UPDATE_BRANCH: release-tools/update-gitaly
|
|
script:
|
|
- 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:
|
|
extends:
|
|
- .notify-slack
|
|
- .delivery:rules:security-pipeline-merge-result-failure
|
|
variables:
|
|
NOTIFY_CHANNEL: f_upcoming_release
|
|
script:
|
|
# <!subteam^S0127FU8PDE> mentions the `@release-managers` group
|
|
- scripts/slack ${NOTIFY_CHANNEL} "<!subteam^S0127FU8PDE> ☠️ Pipeline for merged result failed! ☠️ See ${CI_PIPELINE_URL} (triggered from ${MERGE_REQUEST_URL})" ci_failing "GitLab Release Tools Bot"
|
|
|
|
notify-pipeline-failure:
|
|
extends:
|
|
- .notify-defaults
|
|
- .notify:rules:notify-pipeline-failure
|
|
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}
|
|
variables:
|
|
BROKEN_MASTER_INCIDENTS_PROJECT: "gitlab-org/quality/engineering-productivity/master-broken-incidents"
|
|
BROKEN_MASTER_INCIDENT_JSON: "${CI_PROJECT_DIR}/incident.json"
|
|
SLACK_CHANNEL: "${NOTIFY_PIPELINE_FAILURE_CHANNEL}"
|
|
FAILED_PIPELINE_SLACK_MESSAGE_FILE: "${CI_PROJECT_DIR}/failed_pipeline_slack_message.json"
|
|
before_script:
|
|
- source scripts/utils.sh
|
|
- apt-get update && apt-get install -y jq
|
|
- install_gitlab_gem
|
|
script:
|
|
- |
|
|
if [[ "${CREATE_INCIDENT_FOR_PIPELINE_FAILURE}" == "true" ]]; then
|
|
scripts/create-pipeline-failure-incident.rb -p ${BROKEN_MASTER_INCIDENTS_PROJECT} -f ${BROKEN_MASTER_INCIDENT_JSON} -t ${BROKEN_MASTER_INCIDENTS_PROJECT_TOKEN};
|
|
echosuccess "Created incident $(jq '.web_url' ${BROKEN_MASTER_INCIDENT_JSON})";
|
|
fi
|
|
- |
|
|
scripts/generate-failed-pipeline-slack-message.rb -i ${BROKEN_MASTER_INCIDENT_JSON} -f ${FAILED_PIPELINE_SLACK_MESSAGE_FILE};
|
|
curl -X POST -H 'Content-Type: application/json' --data @${FAILED_PIPELINE_SLACK_MESSAGE_FILE} "$CI_SLACK_WEBHOOK_URL";
|
|
artifacts:
|
|
paths:
|
|
- ${BROKEN_MASTER_INCIDENT_JSON}
|
|
- ${FAILED_PIPELINE_SLACK_MESSAGE_FILE}
|
|
when: always
|
|
expire_in: 2 days
|