From b4b451ac29cd6bc40b4b8e850290f123b1e691ea Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 20 Aug 2020 13:56:52 +0300 Subject: [PATCH 1/3] chore(ci): fix `deploy-code` CI job In #17060, the `deploy-code` job was updated to [include][1] the `init_environment` custom command. This caused the job to start failing, because the `init_environment` command was not compatible with the `cloud-sdk` executor used in `deploy-code`. There were two problems: 1. The `init_environment` command assumes that the working directory is `~/ng`. The `cloud-sdk` executor [did not specify][2] a working directory. Example failures: - On master: https://app.circleci.com/pipelines/github/angular/angular.js/ 152/workflows/812df7b2-4bba-4e9e-a868-8c58db5d40d1/jobs/1594 - On v1.8.x: https://app.circleci.com/pipelines/github/angular/angular.js/ 153/workflows/6a9826ac-d191-4042-8c39-0c969c81e381/jobs/1607 2. The `install_java` step, which is part of the `init_environment` command, relies on `sudo`, which is not available in the `cloud-sdk` executor. Example failure: - [On a PR]: https://app.circleci.com/pipelines/github/angular/angular.js/ 160/workflows/2eed5cfa-751c-44ba-b825-1d6cd5ba3406/jobs/1660 This commit fixes the issues by: 1. Specifying a working directory for the `cloud-sdk` executor. It also updates paths used in other steps of the `deploy-code` job to take the working directory into account. 2. Removing the `install_java` step from the `init_environment` command and adding it explicitly to jobs than require it. [1]: https://github.com/angular/angular.js/blob/83f084e5db95768dcee5/.circleci/config.yml#L359 [2]: https://github.com/angular/angular.js/blob/83f084e5db95768dcee5/.circleci/config.yml#L34-L37 --- .circleci/config.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 17965ab4e5ae..ce18144084f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,6 +35,7 @@ executors: description: The docker container to use when running gcp-gcs commands docker: - image: google/cloud-sdk:alpine@sha256:7d0cae28cb282b76f2d9babe278c63c910d54f0cceca7a65fdf6806e2b43882e + working_directory: ~/ng # Filter Definitions @@ -157,7 +158,6 @@ commands: echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true git config --global gc.auto 0 || true - - install_java init_saucelabs_environment: description: Sets up a domain that resolves to the local host. @@ -231,6 +231,7 @@ jobs: steps: - checkout - init_environment + - install_java - run: name: Running Yarn install command: yarn install --frozen-lockfile --non-interactive @@ -259,6 +260,7 @@ jobs: steps: - custom_attach_workspace - init_environment + - install_java - init_saucelabs_environment - run: yarn grunt test:promises-aplus - run: @@ -358,7 +360,7 @@ jobs: - custom_attach_workspace - init_environment - skip_unless_tag_or_master_or_stable_branch - - run: ls ~/ng/deploy/code + - run: ls deploy/code - run: name: Authenticate and configure Docker command: | @@ -367,7 +369,7 @@ jobs: - run: name: Sync files to code.angularjs.org command: | - gsutil -m rsync -r ~/ng/deploy/code gs://code-angularjs-org-338b8.appspot.com + gsutil -m rsync -r deploy/code gs://code-angularjs-org-338b8.appspot.com # The `deploy-docs` job should only run when all of these conditions are true for the build: # - It is for the `angular/angular.js` repository (not a fork). From 6c5918ba096edbb63aedc690d750c8ac9ff5059d Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 20 Aug 2020 14:07:10 +0300 Subject: [PATCH 2/3] chore(ci): fix `deploy-docs` CI job One step in the `deploy-docs` CI job contains a typo that causes it to fail: `yarn -cwd ...` instead of `yarn --cwd ...` This has been broken since a0488b30a7faa5c84998e4b276388dd839d1a761, but has not been noticed because the job was not running. #17060 configured the job to run as necessary, which brought up the error. Example failure: - On v1.8.x: https://app.circleci.com/pipelines/github/angular/angular.js/ 153/workflows/6a9826ac-d191-4042-8c39-0c969c81e381/jobs/1606 This commit fixes the typo in the command. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ce18144084f8..08ed3d4e52b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -387,7 +387,7 @@ jobs: - skip_unless_stable_branch # Install dependencies for Firebase functions to prevent parsing errors during deployment # See https://github.com/angular/angular.js/pull/16453 - - run: yarn -cwd ~/ng/scripts/docs.angularjs.org-firebase/functions + - run: yarn --cwd scripts/docs.angularjs.org-firebase/functions - run: yarn firebase deploy --token "$FIREBASE_TOKEN" --only hosting workflows: From 6b12fa366cd81940317e5c656e14f950b069d7a7 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 20 Aug 2020 14:14:51 +0300 Subject: [PATCH 3/3] chore(ci): avoid deploying if linting fails Previously, the `prepare-deployment` CI job, which requires all unit and e2e test jobs to have succeeded before running, was ignoring the `lint` job. As a result, deployments might happen even when there were linting issues. This looks like an oversight. This commit ensures that, in addition to unit and e2e tests passing, linting must also pass before deploying the code or documentation. --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 08ed3d4e52b6..55a5622dd878 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -436,6 +436,7 @@ workflows: <<: *run-on-tags-and-master-and-version-branches requires: - setup + - lint - unit-test - unit-test-jquery - e2e-test-1