ci: update circleci post checkout to v2 syntax (#28472)

The `post` key is part of the CircleCI 1.0 syntax is not available in the 2.0 syntax.

PR Close #28472
This commit is contained in:
Filipe Silva 2019-01-31 14:14:59 +00:00 committed by Igor Minar
parent 65d839da03
commit 94223a09e5
1 changed files with 57 additions and 41 deletions

View File

@ -58,7 +58,23 @@ var_6: &job_defaults
# Similar to travis behavior, but not quite the same.
# See https://discuss.circleci.com/t/1662
var_7: &post_checkout
post: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge"
run:
name: Post checkout step
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
# Fetch the head and merge commits for this PR.
git fetch origin +refs/pull/$CIRCLE_PR_NUMBER/head:pr/$CIRCLE_PR_NUMBER/head
git fetch origin +refs/pull/$CIRCLE_PR_NUMBER/merge:pr/$CIRCLE_PR_NUMBER/merge
# Checkout the merged PR for testing as CircleCI will just use the PR head otherwise.
git checkout -qf pr/$CIRCLE_PR_NUMBER/merge
# Reset the merge commit into its PR head.
git reset pr/$CIRCLE_PR_NUMBER/head
# Commit the merge changes into the head of the PR.
# This way we keep the last commit message.
git config user.name "angular-ci"
git config user.email "angular-ci"
git commit . --amend --no-edit
fi
var_8: &yarn_install
run:
@ -97,8 +113,8 @@ jobs:
lint:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -115,8 +131,8 @@ jobs:
<<: *job_defaults
resource_class: xlarge
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -134,8 +150,8 @@ jobs:
<<: *job_defaults
resource_class: xlarge
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -172,8 +188,8 @@ jobs:
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
# Build aio
@ -199,8 +215,8 @@ jobs:
# Needed because before deploying the deploy-production script runs the PWA score tests.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
# Deploy angular.io to production (if necessary)
@ -213,8 +229,8 @@ jobs:
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- attach_workspace:
at: dist
@ -232,8 +248,8 @@ jobs:
test_aio_local_ivy:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- attach_workspace:
at: dist
@ -244,8 +260,8 @@ jobs:
test_aio_tools:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- attach_workspace:
at: dist
@ -264,8 +280,8 @@ jobs:
- image: *browsers_docker_image
parallelism: 3
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- attach_workspace:
at: dist
@ -284,8 +300,8 @@ jobs:
- image: *browsers_docker_image
parallelism: 3
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- attach_workspace:
at: dist
@ -303,8 +319,8 @@ jobs:
environment:
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CI_PULL_REQUEST $CI_COMMIT
@ -322,8 +338,8 @@ jobs:
# Needed because the test-preview script runs e2e tests and the PWA score test with Chrome.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
@ -344,8 +360,8 @@ jobs:
<<: *job_defaults
resource_class: xlarge
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -373,8 +389,8 @@ jobs:
<<: *job_defaults
resource_class: xlarge
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -407,8 +423,8 @@ jobs:
# on a 4G worker so we use a larger machine here too.
resource_class: xlarge
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- attach_workspace:
at: dist
@ -424,8 +440,8 @@ jobs:
publish_snapshot:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *init_environment
# See below - ideally this job should not trigger for non-upstream builds.
# But since it does, we have to check this condition.
@ -455,8 +471,8 @@ jobs:
# which does not load the browser through the Bazel webtesting rules.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- run:
@ -476,8 +492,8 @@ jobs:
# and therefore the tunnel and Karma need to process a lot of file requests and tests.
resource_class: xlarge
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -501,8 +517,8 @@ jobs:
legacy-misc-tests:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *restore_cache
- *init_environment
- *yarn_install
@ -521,8 +537,8 @@ jobs:
docker:
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- checkout
- *post_checkout
- *init_environment
- attach_workspace:
at: dist