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
This commit is contained in:
Kamil Trzciński 2018-02-22 20:36:12 +00:00
commit 6ce56d45ef
3 changed files with 7 additions and 2 deletions

View File

@ -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]

View File

@ -0,0 +1,5 @@
---
title: Fix issue with cache key being empty when variable used as the key
merge_request: 17260
author:
type: fixed

View File

@ -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