debian-mirror-gitlab/.gitlab/ci/notify.gitlab-ci.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
4.5 KiB
YAML
Raw Normal View History

2023-01-13 00:05:48 +05:30
.notify-defaults:
2020-10-24 23:57:45 +05:30
stage: notify
dependencies: []
cache: {}
2023-01-13 00:05:48 +05:30
.notify-slack:
extends:
- .notify-defaults
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}alpine/curl
2021-01-03 14:25:43 +05:30
variables:
MERGE_REQUEST_URL: ${CI_MERGE_REQUEST_PROJECT_URL}/-/merge_requests/${CI_MERGE_REQUEST_IID}
2020-10-24 23:57:45 +05:30
before_script:
2022-11-25 23:54:43 +05:30
- apk update && apk add git bash
2022-10-11 01:57:18 +05:30
- echo "NOTIFY_CHANNEL is ${NOTIFY_CHANNEL}"
- echo "CI_PIPELINE_URL is ${CI_PIPELINE_URL}"
2020-10-24 23:57:45 +05:30
notify-update-gitaly:
extends:
- .notify-slack
rules:
2020-11-24 15:15:51 +05:30
- if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == $GITALY_UPDATE_BRANCH'
2020-10-24 23:57:45 +05:30
when: on_failure
allow_failure: true
variables:
2022-10-11 01:57:18 +05:30
NOTIFY_CHANNEL: g_gitaly
2020-10-24 23:57:45 +05:30
GITALY_UPDATE_BRANCH: release-tools/update-gitaly
script:
2021-01-03 14:25:43 +05:30
- 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"
2022-10-11 01:57:18 +05:30
notify-pipeline-failure:
2023-01-13 00:05:48 +05:30
extends:
- .notify-defaults
- .notify:rules:notify-pipeline-failure
2022-11-25 23:54:43 +05:30
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}
2022-10-11 01:57:18 +05:30
variables:
2023-03-04 22:38:38 +05:30
INCIDENT_PROJECT: "${BROKEN_BRANCH_INCIDENTS_PROJECT}"
BROKEN_BRANCH_PROJECT_TOKEN: "${BROKEN_BRANCH_INCIDENTS_PROJECT_TOKEN}"
INCIDENT_JSON: "${CI_PROJECT_DIR}/incident.json"
2022-11-25 23:54:43 +05:30
SLACK_CHANNEL: "${NOTIFY_PIPELINE_FAILURE_CHANNEL}"
2023-01-13 00:05:48 +05:30
FAILED_PIPELINE_SLACK_MESSAGE_FILE: "${CI_PROJECT_DIR}/failed_pipeline_slack_message.json"
2022-11-25 23:54:43 +05:30
before_script:
- source scripts/utils.sh
- apt-get update && apt-get install -y jq
- install_gitlab_gem
2022-10-11 01:57:18 +05:30
script:
2022-11-25 23:54:43 +05:30
- |
2023-01-13 00:05:48 +05:30
if [[ "${CREATE_INCIDENT_FOR_PIPELINE_FAILURE}" == "true" ]]; then
2023-04-23 21:23:45 +05:30
scripts/create-pipeline-failure-incident.rb -p ${INCIDENT_PROJECT} -f ${INCIDENT_JSON} -t ${BROKEN_BRANCH_PROJECT_TOKEN} ||
scripts/slack ${SLACK_CHANNEL} "☠️ Broken pipeline incident creation failed! ☠️ See ${CI_JOB_URL}" ci_failing "Failed pipeline reporter";
2023-03-04 22:38:38 +05:30
echosuccess "Created incident $(jq '.web_url' ${INCIDENT_JSON})";
2023-01-13 00:05:48 +05:30
fi
- |
2023-03-04 22:38:38 +05:30
scripts/generate-failed-pipeline-slack-message.rb -i ${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" ||
2023-04-23 21:23:45 +05:30
scripts/slack ${SLACK_CHANNEL} "☠️ Broken pipeline notification failed! ☠️ See ${CI_JOB_URL}" ci_failing "Failed pipeline reporter";
2023-03-04 22:38:38 +05:30
2022-11-25 23:54:43 +05:30
artifacts:
paths:
2023-03-04 22:38:38 +05:30
- ${INCIDENT_JSON}
2023-01-13 00:05:48 +05:30
- ${FAILED_PIPELINE_SLACK_MESSAGE_FILE}
2022-11-25 23:54:43 +05:30
when: always
expire_in: 2 days
2023-05-27 22:25:52 +05:30
create-issues-for-failing-tests:
extends:
- .notify-defaults
- .notify:rules:create-issues-for-failing-tests
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}
variables:
FAILED_TESTS_DIR: "${CI_PROJECT_DIR}/tmp/failed_tests"
FAILING_ISSUES_PROJECT: "gitlab-org/quality/engineering-productivity/flaky-tests-playground"
FAILING_ISSUE_JSON_DIR: "${CI_PROJECT_DIR}/tmp/issues"
before_script:
- source ./scripts/utils.sh
- source ./scripts/rspec_helpers.sh
- install_gitlab_gem
script:
- mkdir -p "${FAILING_ISSUE_JSON_DIR}"
- retrieve_failed_tests "${FAILED_TESTS_DIR}" "json" "latest"
- scripts/pipeline/create_test_failure_issues.rb --project "${FAILING_ISSUES_PROJECT}" --tests-report-file "${FAILED_TESTS_DIR}/rspec_failed_tests.json" --issues-json-folder "${FAILING_ISSUE_JSON_DIR}" --api-token "${FAILING_ISSUES_PROJECT_TOKEN}"
- scripts/pipeline/create_test_failure_issues.rb --project "${FAILING_ISSUES_PROJECT}" --tests-report-file "${FAILED_TESTS_DIR}/rspec_ee_failed_tests.json" --issues-json-folder "${FAILING_ISSUE_JSON_DIR}" --api-token "${FAILING_ISSUES_PROJECT_TOKEN}"
artifacts:
paths:
- ${FAILED_TESTS_DIR}/
- ${FAILING_ISSUE_JSON_DIR}/
when: always
expire_in: 2 days
notify-package-and-test-failure:
extends:
- .notify-defaults
- .notify:rules:notify-package-and-test-failure
image: ${GITLAB_DEPENDENCY_PROXY_ADDRESS}ruby:${RUBY_VERSION}
before_script:
- source scripts/utils.sh
- apt-get update
- install_gitlab_gem
script:
- scripts/generate-failed-package-and-test-mr-message.rb