ci: make logic for failure notifications more re-usable (#31202)
PR Close #31202
This commit is contained in:
parent
29df3b0ee2
commit
d72f8c949f
|
@ -106,7 +106,7 @@ var_10: &restore_cache
|
||||||
|
|
||||||
# Branch filter that can be specified for jobs that should only run on publish branches
|
# Branch filter that can be specified for jobs that should only run on publish branches
|
||||||
# (e.g. master or the patch branch)
|
# (e.g. master or the patch branch)
|
||||||
var_12: &publish_branches_filter
|
var_11: &publish_branches_filter
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
@ -117,10 +117,30 @@ var_12: &publish_branches_filter
|
||||||
# `build-npm-packages`.
|
# `build-npm-packages`.
|
||||||
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
||||||
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
|
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
|
||||||
var_13: &attach_workspace
|
var_12: &attach_workspace
|
||||||
attach_workspace:
|
attach_workspace:
|
||||||
at: ~/
|
at: ~/
|
||||||
|
|
||||||
|
var_13: ¬ify_caretaker_on_fail
|
||||||
|
run:
|
||||||
|
when: on_fail
|
||||||
|
name: Notify caretaker about failure
|
||||||
|
# `$SLACK_CARETAKER_WEBHOOK_URL` is a secret env var defined in CircleCI project settings.
|
||||||
|
# The URL comes from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
|
||||||
|
command: |
|
||||||
|
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}"
|
||||||
|
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" $SLACK_CARETAKER_WEBHOOK_URL
|
||||||
|
|
||||||
|
var_14: ¬ify_dev_infra_on_fail
|
||||||
|
run:
|
||||||
|
when: on_fail
|
||||||
|
name: Notify dev-infra about failure
|
||||||
|
# `$SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL` is a secret env var defined in CircleCI project settings.
|
||||||
|
# The URL comes from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
|
||||||
|
command: |
|
||||||
|
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}"
|
||||||
|
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" $SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
|
||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
|
@ -534,16 +554,8 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run tests against https://angular.io/
|
name: Run tests against https://angular.io/
|
||||||
command: ./aio/scripts/test-production.sh https://angular.io/ $CI_AIO_MIN_PWA_SCORE
|
command: ./aio/scripts/test-production.sh https://angular.io/ $CI_AIO_MIN_PWA_SCORE
|
||||||
- run:
|
- *notify_caretaker_on_fail
|
||||||
when: on_fail
|
- *notify_dev_infra_on_fail
|
||||||
name: Notify caretaker and dev-infra about failure
|
|
||||||
# `$SLACK_CARETAKER_WEBHOOK_URL` and `$SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK` are secret env
|
|
||||||
# vars defined in CircleCI project settings.
|
|
||||||
# The URLs come from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
|
|
||||||
command: |
|
|
||||||
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}"
|
|
||||||
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" $SLACK_CARETAKER_WEBHOOK_URL
|
|
||||||
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" $SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
|
|
||||||
|
|
||||||
aio_monitoring_next:
|
aio_monitoring_next:
|
||||||
<<: *job_defaults
|
<<: *job_defaults
|
||||||
|
@ -557,16 +569,8 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run tests against https://next.angular.io/
|
name: Run tests against https://next.angular.io/
|
||||||
command: ./aio/scripts/test-production.sh https://next.angular.io/ $CI_AIO_MIN_PWA_SCORE
|
command: ./aio/scripts/test-production.sh https://next.angular.io/ $CI_AIO_MIN_PWA_SCORE
|
||||||
- run:
|
- *notify_caretaker_on_fail
|
||||||
when: on_fail
|
- *notify_dev_infra_on_fail
|
||||||
name: Notify caretaker and dev-infra about failure
|
|
||||||
# `$SLACK_CARETAKER_WEBHOOK_URL` and `$SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL` are secret env
|
|
||||||
# vars defined in CircleCI project settings.
|
|
||||||
# The URLs come from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
|
|
||||||
command: |
|
|
||||||
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}"
|
|
||||||
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" $SLACK_CARETAKER_WEBHOOK_URL
|
|
||||||
curl --request POST --header "Content-Type: application/json" --data "$notificationJson" $SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
|
|
||||||
|
|
||||||
legacy-unit-tests-saucelabs:
|
legacy-unit-tests-saucelabs:
|
||||||
<<: *job_defaults
|
<<: *job_defaults
|
||||||
|
|
Loading…
Reference in New Issue