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;

View File

@ -0,0 +1,2 @@
# Fetched from https://github.com/yarnpkg/yarn/releases/download/v1.13.0/yarn-1.13.0.js
licenses(["notice"])

View File

@ -0,0 +1,26 @@
BSD 2-Clause License
For Yarn software
Copyright (c) 2016-present, Yarn Contributors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because one or more lines are too long