diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-21 11:15:28 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-21 11:15:28 +0000 |
commit | 54729d2c28c7e612cafbf81d980f274f6405df2a (patch) | |
tree | 51bb211a3ef1425ac3d30d646893f7cdebd87637 /lib | |
parent | a4ff270d59ef951538cb9d3962ebc8bc7d990016 (diff) | |
parent | c45a6bf3ba13cbd532852dfcc48ef3fd7aa545e4 (diff) | |
download | gitlab-ce-54729d2c28c7e612cafbf81d980f274f6405df2a.tar.gz |
Merge branch 'ci/cache-key' into 'master'
Added cache:key to .gitlab-ci.yml allowing to fine tune the caching
The `cache:key` allows you to define the affinity mask of caching, allowing to have single cache for all jobs, or cache per-job, or per-branch, or any other way you would need:
1. Cache per-build for all branches:
```
cache:
key: "$CI_BUILD_NAME"
untracked: true
```
2. Cache per-branch for all jobs:
```
cache:
key: "$CI_BUILD_REF"
untracked: true
```
/cc @DouweM @grzesiek @axil
See merge request !2436
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index bcdfd38d292..1a3f662811a 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -115,6 +115,10 @@ module Ci end if @cache + if @cache[:key] && !validate_string(@cache[:key]) + raise ValidationError, "cache:key parameter should be a string" + end + if @cache[:untracked] && !validate_boolean(@cache[:untracked]) raise ValidationError, "cache:untracked parameter should be an boolean" end @@ -198,6 +202,10 @@ module Ci end def validate_job_cache!(name, job) + if job[:cache][:key] && !validate_string(job[:cache][:key]) + raise ValidationError, "#{name} job: cache:key parameter should be a string" + end + if job[:cache][:untracked] && !validate_boolean(job[:cache][:untracked]) raise ValidationError, "#{name} job: cache:untracked parameter should be an boolean" end |