diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-10-27 09:50:57 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-10-27 10:38:02 +0300 |
commit | 441a27bdd78881b619e2bfbd6acb74abc459fd66 (patch) | |
tree | 0264c61bc48d4fa399cbebc6ef7f31de61628169 | |
parent | 2eaac7b8f356ff7bccfdc04a3c55488a4bb2e431 (diff) |
ci: Fix caching to not push by default
Our default cache definition which is includde by most of our jobs
doesn't specify a cache policy, which thus means that by default they'll
use the push-pull policy. This doesn't make all that much sense though:
we have preparatory "build" jobs which build sources, and these should
be the only ones updating the cache.
Refactor the cache definition to use a "pull" policy by default and
explicitly override it in the build jobs. While at it, this commit also
deduplicates the different definitions by making better use of anchors.
-rw-r--r-- | .gitlab-ci.yml | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3db504bd3..12fa1ba23 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,7 +51,7 @@ danger-review: fi .cache: &cache_definition - cache: + cache: &cache_configuration key: files: - Makefile @@ -60,21 +60,11 @@ danger-review: paths: - _build/deps - ruby/vendor/bundle + policy: pull .test_template: &test_definition <<: *cache_definition stage: test - # Override the cache definition for pull - cache: - key: - files: - - Makefile - - ruby/Gemfile.lock - prefix: git-${GIT_VERSION}-ruby-${RUBY_VERSION} - paths: - - _build/deps - - ruby/vendor/bundle - policy: pull artifacts: paths: - ruby/tmp/gitaly-rspec-test.log @@ -129,9 +119,11 @@ proto: when: on_failure build: - <<: *cache_definition stage: build image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-${RUBY_VERSION}-golang-${GO_VERSION}-git-2.31 + cache: + <<: *cache_configuration + policy: pull-push script: - go version - make all git |