Commit 249e94f7 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'caalberts-remove-package-qa-notification' into 'master'

Remove `package-and-qa` notifications

Closes gitlab-org/quality/team-tasks#298

See merge request gitlab-org/gitlab!22508
parents 1011dec1 b54a2dfa
......@@ -10,7 +10,6 @@ stages:
- review
- qa
- post-qa
- notification
- pages
variables:
......@@ -36,7 +35,6 @@ include:
- local: .gitlab/ci/frontend.gitlab-ci.yml
- local: .gitlab/ci/global.gitlab-ci.yml
- local: .gitlab/ci/memory.gitlab-ci.yml
- local: .gitlab/ci/notifications.gitlab-ci.yml
- local: .gitlab/ci/pages.gitlab-ci.yml
- local: .gitlab/ci/qa.gitlab-ci.yml
- local: .gitlab/ci/reports.gitlab-ci.yml
......
# Make sure to update all the similar conditions in other CI config files if you modify these conditions
.if-canonical-gitlab-schedule: &if-canonical-gitlab-schedule
if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_NAMESPACE =~ /^gitlab-org($|\/)/ && $CI_PIPELINE_SOURCE == "schedule"'
.notify:
image: ruby:2.6-alpine
stage: notification
dependencies: []
cache: {}
before_script:
- apk update && apk add git curl bash
- source scripts/utils.sh
- source scripts/notifications.sh
- install_gitlab_gem
variables:
COMMIT_NOTES_URL: "https://${CI_SERVER_HOST}/${CI_PROJECT_PATH}/commit/${CI_COMMIT_SHA}#notes-list"
package-and-qa:notify-failure:
extends: .notify
rules:
- <<: *if-canonical-gitlab-schedule
when: manual # TODO: remove notify job if not necessary
script:
- 'export NOTIFICATION_MESSAGE=":skull_and_crossbones: Scheduled QA against master failed! :skull_and_crossbones: See ${CI_PIPELINE_URL}. For downstream pipelines, see ${COMMIT_NOTES_URL}"'
- 'notify_on_job_failure package-and-qa qa-master "${NOTIFICATION_MESSAGE}" ci_failing'
needs: ["package-and-qa"]
allow_failure: true
......@@ -264,10 +264,6 @@ subgraph "`qa` stage"
dast -.-> |needs and depends on| G;
end
subgraph "`notification` stage"
NOTIFICATION2["package-and-qa:notify-failure<br>(manual)"] -.-> |needs| Q;
end
subgraph "`post-test` stage"
M
end
......
# Sends Slack notification MSG to CI_SLACK_WEBHOOK_URL (which needs to be set).
# ICON_EMOJI needs to be set to an icon emoji name (without the `:` around it).
function notify_slack() {
CHANNEL=$1
MSG=$2
ICON_EMOJI=$3
if [ -z "$CHANNEL" ] || [ -z "$CI_SLACK_WEBHOOK_URL" ] || [ -z "$MSG" ] || [ -z "$ICON_EMOJI" ]; then
echo "Missing argument(s) - Use: $0 channel message icon_emoji"
echo "and set CI_SLACK_WEBHOOK_URL environment variable."
else
curl -X POST --data-urlencode 'payload={"channel": "#'"${CHANNEL}"'", "username": "GitLab QA Bot", "text": "'"${MSG}"'", "icon_emoji": "'":${ICON_EMOJI}:"'"}' "${CI_SLACK_WEBHOOK_URL}"
fi
}
function notify_on_job_failure() {
JOB_NAME=$1
CHANNEL=$2
MSG=$3
ICON_EMOJI=$4
local job_id
job_id=$(scripts/get-job-id "$CI_PROJECT_ID" "$CI_PIPELINE_ID" "$JOB_NAME" -s failed)
if [ -n "${job_id}" ]; then
notify_slack "${CHANNEL}" "${MSG}" "${ICON_EMOJI}"
fi
}
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