summaryrefslogtreecommitdiff
path: root/.gitlab/ci/notifications.gitlab-ci.yml
blob: 1ec61acdfca25f47e6e2a9d42251d218a0c7647a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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