summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2018-02-22 20:36:12 +0000
committerIan Baum <ibaum@gitlab.com>2018-02-23 14:01:11 -0600
commitef94261bf89a03ff45ce6f57e86c36d7e30b3e74 (patch)
tree286e12f7b98c399e508abd896b7b52f586e3ee9c
parent94fdf6a4e033e54d35996a6e546003392d88a8d7 (diff)
downloadgitlab-ce-ef94261bf89a03ff45ce6f57e86c36d7e30b3e74.tar.gz
Merge branch '43373-fix-cache-index-appending' into 'master'
Resolve "cache key for CI stopped working" Closes #43373 See merge request gitlab-org/gitlab-ce!17260
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--changelogs/unreleased/43373-fix-cache-index-appending.yml5
-rw-r--r--spec/models/ci/build_spec.rb2
3 files changed, 7 insertions, 2 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 20534b8eed0..c48c5176987 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -467,7 +467,7 @@ module Ci
if cache && project.jobs_cache_index
cache = cache.merge(
- key: "#{cache[:key]}_#{project.jobs_cache_index}")
+ key: "#{cache[:key]}-#{project.jobs_cache_index}")
end
[cache]
diff --git a/changelogs/unreleased/43373-fix-cache-index-appending.yml b/changelogs/unreleased/43373-fix-cache-index-appending.yml
new file mode 100644
index 00000000000..fdb293ea04d
--- /dev/null
+++ b/changelogs/unreleased/43373-fix-cache-index-appending.yml
@@ -0,0 +1,5 @@
+---
+title: Fix issue with cache key being empty when variable used as the key
+merge_request: 17260
+author:
+type: fixed
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 3e8b9ea472a..922b4e19df0 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -277,7 +277,7 @@ describe Ci::Build do
allow_any_instance_of(Project).to receive(:jobs_cache_index).and_return(1)
end
- it { is_expected.to be_an(Array).and all(include(key: "key_1")) }
+ it { is_expected.to be_an(Array).and all(include(key: "key-1")) }
end
context 'when project does not have jobs_cache_index' do