ci: Vendor yarn into our repo (#28839)

This avoids a dynamic dependency on fetching a package from the internet in our CI.
We have observed that this is not 100% reliable.

PR Close #28839
This commit is contained in:
Alex Eagle
2019-02-19 13:15:42 -08:00
committed by Igor Minar
parent bca0b44ff2
commit 9cecb0b5d2
5 changed files with 136141 additions and 6 deletions

View File

@ -28,14 +28,15 @@ var_2: &browsers_docker_image circleci/node:10.12-browsers
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v2-angular-node-10.12-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}
# Initializes the CI environment by setting up common environment variables and
# downloading Yarn. Yarn is used by most jobs and therefore is part of this anchor.
# Initializes the CI environment by setting up common environment variables.
var_4: &init_environment
run:
name: Initializing environment (setting up variables, downloading Yarn)
name: Initializing environment (setting up variables, removing Yarn)
# Remove the yarn installed in the docker container; we want our own version
command: |
sudo rm /usr/local/bin/yarn
source ./.circleci/env.sh
curl -o- -L https://yarnpkg.com/install.sh | PROFILE=$BASH_ENV bash -s -- --version "$CI_YARN_VERSION"
echo "Yarn version: $(yarn --version)"
var_5: &setup_bazel_remote_execution
run:
@ -97,7 +98,9 @@ jobs:
- run: 'yarn bazel:lint ||
(echo -e "\n.bzl files have lint errors. Please run ''yarn bazel:lint-fix''"; exit 1)'
- run: ./node_modules/.bin/gulp lint
# Use `yarn gulp ...` (instead of `node_modules/.bin/gulp ...`) to ensure that yarn
# (which is an exported bash function) will be available to processes spawned by gulp.
- run: yarn gulp lint
test:
<<: *job_defaults

View File

@ -32,7 +32,6 @@ setPublicVar CI_COMMIT_RANGE "`[[ ${CIRCLE_PR_NUMBER:-false} != false ]] && echo
setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}";
setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME";
setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME";
setPublicVar CI_YARN_VERSION "1.13.0";
####################################################################################################
@ -63,5 +62,12 @@ setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
####################################################################################################
# Define our own yarn command for CircleCI.
####################################################################################################
echo "function yarn () { /usr/bin/env node $projectDir/third_party/github.com/yarnpkg/yarn/releases/yarn-1.13.0.js \"\$@\"; }" >> $BASH_ENV;
echo "export -f yarn;" >> $BASH_ENV;
# Source `$BASH_ENV` to make the variables available immediately.
source $BASH_ENV;