ci: refactor notification commands into a single parametrized one (#32745)
notify_caretaker_on_fail and notify_dev_infra_on_fail are the same, except for the url they notify. PR Close #32745
This commit is contained in:
parent
653eb0fef9
commit
0f3a48e4d4
@ -63,7 +63,7 @@ var_9: &ignore_pull_requests
|
|||||||
# `CI_CHROMEDRIVER_VERSION_ARG` env var (in `.circleci/env.sh`) points to a ChromeDriver
|
# `CI_CHROMEDRIVER_VERSION_ARG` env var (in `.circleci/env.sh`) points to a ChromeDriver
|
||||||
# version that is compatible with the Chrome version in the image.
|
# version that is compatible with the Chrome version in the image.
|
||||||
executors:
|
executors:
|
||||||
action-executor:
|
default-executor:
|
||||||
parameters:
|
parameters:
|
||||||
resource_class:
|
resource_class:
|
||||||
type: string
|
type: string
|
||||||
@ -178,34 +178,26 @@ commands:
|
|||||||
- run: echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV
|
- run: echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV
|
||||||
- run: ./.circleci/setup-rbe.sh .bazelrc.user
|
- run: ./.circleci/setup-rbe.sh .bazelrc.user
|
||||||
|
|
||||||
notify_caretaker_on_fail:
|
notify_webhook_on_fail:
|
||||||
description: Notify caretaker about failure
|
description: Notify a webhook about failure
|
||||||
|
parameters:
|
||||||
|
# `webhook_url_env_var` are secret env vars defined in CircleCI project settings.
|
||||||
|
# The URLs come from https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
|
||||||
|
webhook_url_env_var:
|
||||||
|
type: env_var_name
|
||||||
steps:
|
steps:
|
||||||
- run:
|
- run:
|
||||||
when: on_fail
|
when: on_fail
|
||||||
# `$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: |
|
command: |
|
||||||
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job for $CIRCLE_BRANCH branch failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}"
|
notificationJson="{\"text\":\":x: \`$CIRCLE_JOB\` job for $CIRCLE_BRANCH branch 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" ${<< parameters.webhook_url_env_var >>}
|
||||||
|
|
||||||
notify_dev_infra_on_fail:
|
|
||||||
description: Notify dev-infra about failure
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
when: on_fail
|
|
||||||
# `$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 for $CIRCLE_BRANCH branch 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
|
|
||||||
|
|
||||||
# Job definitions
|
# Job definitions
|
||||||
# Jobs can include parameters that are passed in the workflow job invocation.
|
# Jobs can include parameters that are passed in the workflow job invocation.
|
||||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs
|
# https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
@ -249,7 +241,7 @@ jobs:
|
|||||||
- ./bazel_repository_cache
|
- ./bazel_repository_cache
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
- init_environment
|
- init_environment
|
||||||
@ -265,7 +257,7 @@ jobs:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
executor:
|
executor:
|
||||||
name: action-executor
|
name: default-executor
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
@ -280,7 +272,7 @@ jobs:
|
|||||||
# Temporary job to test what will happen when we flip the Ivy flag to true
|
# Temporary job to test what will happen when we flip the Ivy flag to true
|
||||||
test_ivy_aot:
|
test_ivy_aot:
|
||||||
executor:
|
executor:
|
||||||
name: action-executor
|
name: default-executor
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
@ -321,7 +313,7 @@ jobs:
|
|||||||
# NOTE: This is currently limited to master builds only. See the `default_workflow` configuration.
|
# NOTE: This is currently limited to master builds only. See the `default_workflow` configuration.
|
||||||
test_saucelabs_bazel:
|
test_saucelabs_bazel:
|
||||||
executor:
|
executor:
|
||||||
name: action-executor
|
name: default-executor
|
||||||
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
|
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
|
||||||
# container for this job. This is necessary because we launch a lot of browsers concurrently
|
# container for this job. This is necessary because we launch a lot of browsers concurrently
|
||||||
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
|
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
|
||||||
@ -346,7 +338,8 @@ jobs:
|
|||||||
--key $(echo $SAUCE_ACCESS_KEY | rev) \
|
--key $(echo $SAUCE_ACCESS_KEY | rev) \
|
||||||
yarn bazel test //:test_web_all
|
yarn bazel test //:test_web_all
|
||||||
no_output_timeout: 20m
|
no_output_timeout: 20m
|
||||||
- notify_dev_infra_on_fail
|
- notify_webhook_on_fail:
|
||||||
|
webhook_url_env_var: SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
|
||||||
|
|
||||||
test_aio:
|
test_aio:
|
||||||
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
|
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
|
||||||
@ -403,7 +396,7 @@ jobs:
|
|||||||
- run: yarn --cwd aio payload-size aio-local<<# parameters.ivy >>-ivy<</ parameters.ivy >>
|
- run: yarn --cwd aio payload-size aio-local<<# parameters.ivy >>-ivy<</ parameters.ivy >>
|
||||||
|
|
||||||
test_aio_tools:
|
test_aio_tools:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
- init_environment
|
- init_environment
|
||||||
@ -445,7 +438,7 @@ jobs:
|
|||||||
|
|
||||||
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
|
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
|
||||||
aio_preview:
|
aio_preview:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
environment:
|
environment:
|
||||||
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
|
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
|
||||||
steps:
|
steps:
|
||||||
@ -482,7 +475,7 @@ jobs:
|
|||||||
# Build the view engine npm packages. No new jobs should depend on this.
|
# Build the view engine npm packages. No new jobs should depend on this.
|
||||||
build-npm-packages:
|
build-npm-packages:
|
||||||
executor:
|
executor:
|
||||||
name: action-executor
|
name: default-executor
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
@ -509,7 +502,7 @@ jobs:
|
|||||||
# Build the ivy npm packages.
|
# Build the ivy npm packages.
|
||||||
build-ivy-npm-packages:
|
build-ivy-npm-packages:
|
||||||
executor:
|
executor:
|
||||||
name: action-executor
|
name: default-executor
|
||||||
resource_class: xlarge
|
resource_class: xlarge
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
@ -550,7 +543,7 @@ jobs:
|
|||||||
# This job updates the content of repos like github.com/angular/core-builds
|
# This job updates the content of repos like github.com/angular/core-builds
|
||||||
# for every green build on angular/angular.
|
# for every green build on angular/angular.
|
||||||
publish_snapshot:
|
publish_snapshot:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
steps:
|
steps:
|
||||||
# See below - ideally this job should not trigger for non-upstream builds.
|
# See below - ideally this job should not trigger for non-upstream builds.
|
||||||
# But since it does, we have to check this condition.
|
# But since it does, we have to check this condition.
|
||||||
@ -594,8 +587,10 @@ 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
|
||||||
- notify_caretaker_on_fail
|
- notify_webhook_on_fail:
|
||||||
- notify_dev_infra_on_fail
|
webhook_url_env_var: SLACK_CARETAKER_WEBHOOK_URL
|
||||||
|
- notify_webhook_on_fail:
|
||||||
|
webhook_url_env_var: SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
|
||||||
|
|
||||||
aio_monitoring_next:
|
aio_monitoring_next:
|
||||||
# This job needs Chrome to be globally installed because the tests run with Protractor
|
# This job needs Chrome to be globally installed because the tests run with Protractor
|
||||||
@ -607,12 +602,14 @@ 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
|
||||||
- notify_caretaker_on_fail
|
- notify_webhook_on_fail:
|
||||||
- notify_dev_infra_on_fail
|
webhook_url_env_var: SLACK_CARETAKER_WEBHOOK_URL
|
||||||
|
- notify_webhook_on_fail:
|
||||||
|
webhook_url_env_var: SLACK_DEV_INFRA_CI_FAILURES_WEBHOOK_URL
|
||||||
|
|
||||||
legacy-unit-tests-saucelabs:
|
legacy-unit-tests-saucelabs:
|
||||||
executor:
|
executor:
|
||||||
name: action-executor
|
name: default-executor
|
||||||
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
|
# In order to avoid the bottleneck of having a slow host machine, we acquire a better
|
||||||
# container for this job. This is necessary because we launch a lot of browsers concurrently
|
# container for this job. This is necessary because we launch a lot of browsers concurrently
|
||||||
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
|
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
|
||||||
@ -638,7 +635,7 @@ jobs:
|
|||||||
- run: ./scripts/saucelabs/stop-tunnel.sh
|
- run: ./scripts/saucelabs/stop-tunnel.sh
|
||||||
|
|
||||||
legacy-misc-tests:
|
legacy-misc-tests:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
- init_environment
|
- init_environment
|
||||||
@ -688,7 +685,7 @@ jobs:
|
|||||||
command: ./scripts/ci/run_angular_material_unit_tests.sh
|
command: ./scripts/ci/run_angular_material_unit_tests.sh
|
||||||
|
|
||||||
test_zonejs:
|
test_zonejs:
|
||||||
executor: action-executor
|
executor: default-executor
|
||||||
steps:
|
steps:
|
||||||
- custom_attach_workspace
|
- custom_attach_workspace
|
||||||
- init_environment
|
- init_environment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user