diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-06-06 10:53:21 +0300 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-06-07 02:45:48 +0300 |
commit | 904b38820aee23d90ce04426ebd84b0eaf4c983a (patch) | |
tree | cd99b594f8143558128ff202f83c89ff885d289a | |
parent | e6a88b024fa7f8e1ec5b712744d0e0d118b026e6 (diff) |
Tar assets-compile-cache cache filestar-assets-compile-cache-artifacts
Speeds up zipping and uploading of cache
-rw-r--r-- | .gitlab/ci/frontend.gitlab-ci.yml | 19 | ||||
-rwxr-xr-x | scripts/assets-compile-cache/archive | 10 | ||||
-rwxr-xr-x | scripts/assets-compile-cache/clean-old-assets (renamed from scripts/clean-old-cached-assets) | 0 | ||||
-rwxr-xr-x | scripts/assets-compile-cache/extract | 9 |
4 files changed, 32 insertions, 6 deletions
diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index fd5733593ef..cc7e20ba9bc 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -1,11 +1,18 @@ .assets-compile-cache: &assets-compile-cache cache: - key: "assets-compile:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v5" + key: "assets-compile-compressed:vendor_ruby:.yarn-cache:tmp_cache_assets_sprockets:v1" paths: - - vendor/ruby/ - - .yarn-cache/ - - tmp/cache/assets/sprockets + - cache_archives policy: pull-push + before_script: + - scripts/assets-compile-cache/extract + - date + - source scripts/utils.sh + - source scripts/prepare_build.sh + - date + after_script: + - scripts/assets-compile-cache/archive + - date .use-pg: &use-pg services: @@ -37,7 +44,7 @@ gitlab:assets:compile: - free -m - retry bundle exec rake gitlab:assets:compile - time scripts/build_assets_image - - scripts/clean-old-cached-assets + - scripts/assets-compile-cache/clean-old-assets - rm -f /etc/apt/sources.list.d/google*.list # We don't need to update Chrome here # Play dependent manual jobs - install_api_client_dependencies_with_apt @@ -68,7 +75,7 @@ compile-assets: - retry yarn install --frozen-lockfile --cache-folder .yarn-cache - free -m - retry bundle exec rake gitlab:assets:compile - - scripts/clean-old-cached-assets + - scripts/assets-compile-cache/clean-old-assets variables: # we override the max_old_space_size to prevent OOM errors NODE_OPTIONS: --max_old_space_size=3584 diff --git a/scripts/assets-compile-cache/archive b/scripts/assets-compile-cache/archive new file mode 100755 index 00000000000..85b145ec3b4 --- /dev/null +++ b/scripts/assets-compile-cache/archive @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Archiving cache files..." + +mkdir -p cache_archives +[ -d vendor/ruby ] && tar -czf cache_archives/vendor-ruby.tar.gz vendor/ruby +[ -d .yarn-cache ] && tar -czf cache_archives/yarn-cache.tar.gz .yarn-cache +[ -d tmp/cache/assets/sprockets ] && tar -czf cache_archives/tmp-cache-assets-sprockets.tar.gz tmp/cache/assets/sprockets + +echo "Done!" diff --git a/scripts/clean-old-cached-assets b/scripts/assets-compile-cache/clean-old-assets index 8bdd3a9cdb6..8bdd3a9cdb6 100755 --- a/scripts/clean-old-cached-assets +++ b/scripts/assets-compile-cache/clean-old-assets diff --git a/scripts/assets-compile-cache/extract b/scripts/assets-compile-cache/extract new file mode 100755 index 00000000000..aebf92a9347 --- /dev/null +++ b/scripts/assets-compile-cache/extract @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Extracting cache files..." + +[ -f cache_archives/vendor-ruby.tar.gz ] && tar -xzf cache_archives/vendor-ruby.tar.gz +[ -f cache_archives/yarn-cache.tar.gz ] && tar -xzf cache_archives/yarn-cache.tar.gz +[ -f cache_archives/tmp-cache-assets-sprockets.tar.gz ] && tar -xzf cache_archives/tmp-cache-assets-sprockets.tar.gz + +echo "Done!" |