Use Ci::ExpirePipelineCacheService
to set ProjectPipelinestatus
This commit is contained in:
parent
516a405eb2
commit
9eded57dd2
4 changed files with 10 additions and 17 deletions
|
@ -98,7 +98,6 @@ module Ci
|
|||
PipelineHooksWorker.perform_async(id)
|
||||
Ci::ExpirePipelineCacheService.new(project, nil)
|
||||
.execute(pipeline)
|
||||
refresh_project_build_status_cache
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -392,10 +391,6 @@ module Ci
|
|||
.fabricate!
|
||||
end
|
||||
|
||||
def refresh_project_build_status_cache
|
||||
Gitlab::Cache::Ci::ProjectPipelineStatus.update_for_pipeline(self)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pipeline_data
|
||||
|
|
|
@ -10,6 +10,8 @@ module Ci
|
|||
store.touch(commit_pipelines_path) if pipeline.commit
|
||||
store.touch(new_merge_request_pipelines_path)
|
||||
merge_requests_pipelines_paths.each { |path| store.touch(path) }
|
||||
|
||||
Gitlab::Cache::Ci::ProjectPipelineStatus.update_for_pipeline(@pipeline)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -375,7 +375,7 @@ describe Ci::Pipeline, models: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'pipeline ETag caching' do
|
||||
describe 'pipeline caching' do
|
||||
it 'executes ExpirePipelinesCacheService' do
|
||||
expect_any_instance_of(Ci::ExpirePipelineCacheService).to receive(:execute).with(pipeline)
|
||||
|
||||
|
@ -1079,17 +1079,6 @@ describe Ci::Pipeline, models: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'update project cache when transitioning' do
|
||||
let(:pipeline) { create(:ci_pipeline, sha: '123456') }
|
||||
|
||||
it 'updates the cached status' do
|
||||
expect(Gitlab::Cache::Ci::ProjectPipelineStatus).to receive(:update_for_pipeline).
|
||||
with(pipeline)
|
||||
|
||||
pipeline.block
|
||||
end
|
||||
end
|
||||
|
||||
describe 'notifications when pipeline success or failed' do
|
||||
let(:project) { create(:project, :repository) }
|
||||
|
||||
|
|
|
@ -16,5 +16,12 @@ describe Ci::ExpirePipelineCacheService, services: true do
|
|||
|
||||
subject.execute(pipeline)
|
||||
end
|
||||
|
||||
it 'updates the cached status for a project' do
|
||||
expect(Gitlab::Cache::Ci::ProjectPipelineStatus).to receive(:update_for_pipeline).
|
||||
with(pipeline)
|
||||
|
||||
subject.execute(pipeline)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue