From e5a18cd731f9fb2f66e2764bf6cafd783a67bcb6 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 12 May 2017 13:09:49 -0500 Subject: [PATCH 1/4] instruct yarn to utilize the persistant .yarn-cache directory --- .gitignore | 1 + .gitlab-ci.yml | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f3decfd7dfe..89da29fd790 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ eslint-report.html .sass-cache/ /.secret /.vagrant +/.yarn-cache /.byebug_history /Vagrantfile /backups/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7fbfda4a5a8..f4f601b4d0e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ cache: key: "ruby-233" paths: - vendor/ruby + - .yarn-cache variables: MYSQL_ALLOW_EMPTY_PASSWORD: "1" @@ -186,7 +187,7 @@ setup-test-env: stage: prepare script: - node --version - - yarn install --pure-lockfile + - yarn install --pure-lockfile --cache-folder .yarn-cache - bundle exec rake gitlab:assets:compile - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' artifacts: @@ -400,7 +401,8 @@ rake gitlab:assets:compile: SKIP_STORAGE_VALIDATION: "true" WEBPACK_REPORT: "true" script: - - bundle exec rake yarn:install gitlab:assets:compile + - yarn install --pure-lockfile --production --cache-folder .yarn-cache + - bundle exec rake gitlab:assets:compile artifacts: name: webpack-report expire_in: 31d From d93efcc210c0dae5f39f1a33d6745786bf660478 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 15 May 2017 15:00:23 -0500 Subject: [PATCH 2/4] add trailing slash to .yarn-cache to clearly identify it as a directory --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4f601b4d0e..aa6fd511d21 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ cache: key: "ruby-233" paths: - vendor/ruby - - .yarn-cache + - .yarn-cache/ variables: MYSQL_ALLOW_EMPTY_PASSWORD: "1" From dc5be03380d22f9931b442a12d56c2f313894013 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 15 May 2017 15:16:30 -0500 Subject: [PATCH 3/4] add CHANGELOG.md entry for !11343 --- ...p-yarn-install-in-ci-by-utilizing-inter-pipeline-cache.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/32219-speed-up-yarn-install-in-ci-by-utilizing-inter-pipeline-cache.yml diff --git a/changelogs/unreleased/32219-speed-up-yarn-install-in-ci-by-utilizing-inter-pipeline-cache.yml b/changelogs/unreleased/32219-speed-up-yarn-install-in-ci-by-utilizing-inter-pipeline-cache.yml new file mode 100644 index 00000000000..7fb3cb3a30b --- /dev/null +++ b/changelogs/unreleased/32219-speed-up-yarn-install-in-ci-by-utilizing-inter-pipeline-cache.yml @@ -0,0 +1,4 @@ +--- +title: Cache npm modules between pipelines with yarn to speed up setup-test-env +merge_request: 11343 +author: From 1f581d761b71286b5736b304a1e749e58befd146 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 15 May 2017 15:41:22 -0500 Subject: [PATCH 4/4] alter cache key to prevent other pipeline configs from overwriting --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa6fd511d21..5463a020de7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.3.3-golang-1.8-git-2.7-phantomjs-2.1-node-7.1-postgresql-9.6" cache: - key: "ruby-233" + key: "ruby-233-with-yarn" paths: - vendor/ruby - .yarn-cache/