From e5380cdc1128d2dbb4982a521d041d336b116505 Mon Sep 17 00:00:00 2001 From: Tobias Huste <t.huste@hzdr.de> Date: Tue, 30 Aug 2022 14:24:44 +0200 Subject: [PATCH] Fix and improve caching in GitLab CI --- .gitlab-ci.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ffe00d5e4..11f821a70 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,19 +13,20 @@ stages: - public expire_in: 1d -.cache_latest: &cache_latest +.caching: &caching cache: - key: latest - paths: - - vendor/bundle - - assets/img/jumbotrons - -.cache_production: &cache_production - cache: - key: production - paths: - - vendor/bundle - - assets/img/jumbotrons + - key: + files: + - Gemfile.lock + prefix: "$CI_JOB_IMAGE" + paths: + - vendor/bundle + - key: jumbotron-cache + paths: + - assets/img/jumbotrons/desktop + - assets/img/jumbotrons/display_2k + - assets/img/jumbotrons/phone + - assets/img/jumbotrons/tablet .common_production: &production_before_script before_script: @@ -36,7 +37,7 @@ stages: - gem install bundler --no-document - bundle config set without 'test' - bundle install --jobs $(nproc) - <<: *cache_production + <<: *caching .common_latest: &latest_before_script before_script: @@ -48,7 +49,7 @@ stages: - bundle config set without 'test' - bundle install --jobs $(nproc) --without test "${FLAGS[@]}" - bundle update --jobs $(nproc) "${FLAGS[@]}" - <<: *cache_latest + <<: *caching .common_variables: &common_variables GIT_SUBMODULE_STRATEGY: recursive @@ -109,7 +110,7 @@ stages: --assume-extension public/" # Use yaml-lint tool to check yaml files. - "bundle exec yaml-lint _data/ _config.yml" - <<: *cache_production + <<: *caching # https://docs.gitlab.com/ce/ci/yaml/#interruptible interruptible: true -- GitLab