Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9eded57d
Commit
9eded57d
authored
Apr 07, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `Ci::ExpirePipelineCacheService` to set `ProjectPipelinestatus`
parent
516a405e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
17 deletions
+10
-17
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+0
-5
app/services/ci/expire_pipeline_cache_service.rb
app/services/ci/expire_pipeline_cache_service.rb
+2
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+1
-12
spec/services/ci/expire_pipeline_cache_service_spec.rb
spec/services/ci/expire_pipeline_cache_service_spec.rb
+7
-0
No files found.
app/models/ci/pipeline.rb
View file @
9eded57d
...
@@ -98,7 +98,6 @@ module Ci
...
@@ -98,7 +98,6 @@ module Ci
PipelineHooksWorker
.
perform_async
(
id
)
PipelineHooksWorker
.
perform_async
(
id
)
Ci
::
ExpirePipelineCacheService
.
new
(
project
,
nil
)
Ci
::
ExpirePipelineCacheService
.
new
(
project
,
nil
)
.
execute
(
pipeline
)
.
execute
(
pipeline
)
refresh_project_build_status_cache
end
end
end
end
...
@@ -392,10 +391,6 @@ module Ci
...
@@ -392,10 +391,6 @@ module Ci
.
fabricate!
.
fabricate!
end
end
def
refresh_project_build_status_cache
Gitlab
::
Cache
::
Ci
::
ProjectPipelineStatus
.
update_for_pipeline
(
self
)
end
private
private
def
pipeline_data
def
pipeline_data
...
...
app/services/ci/expire_pipeline_cache_service.rb
View file @
9eded57d
...
@@ -10,6 +10,8 @@ module Ci
...
@@ -10,6 +10,8 @@ module Ci
store
.
touch
(
commit_pipelines_path
)
if
pipeline
.
commit
store
.
touch
(
commit_pipelines_path
)
if
pipeline
.
commit
store
.
touch
(
new_merge_request_pipelines_path
)
store
.
touch
(
new_merge_request_pipelines_path
)
merge_requests_pipelines_paths
.
each
{
|
path
|
store
.
touch
(
path
)
}
merge_requests_pipelines_paths
.
each
{
|
path
|
store
.
touch
(
path
)
}
Gitlab
::
Cache
::
Ci
::
ProjectPipelineStatus
.
update_for_pipeline
(
@pipeline
)
end
end
private
private
...
...
spec/models/ci/pipeline_spec.rb
View file @
9eded57d
...
@@ -375,7 +375,7 @@ describe Ci::Pipeline, models: true do
...
@@ -375,7 +375,7 @@ describe Ci::Pipeline, models: true do
end
end
end
end
describe
'pipeline
ETag
caching'
do
describe
'pipeline caching'
do
it
'executes ExpirePipelinesCacheService'
do
it
'executes ExpirePipelinesCacheService'
do
expect_any_instance_of
(
Ci
::
ExpirePipelineCacheService
).
to
receive
(
:execute
).
with
(
pipeline
)
expect_any_instance_of
(
Ci
::
ExpirePipelineCacheService
).
to
receive
(
:execute
).
with
(
pipeline
)
...
@@ -1079,17 +1079,6 @@ describe Ci::Pipeline, models: true do
...
@@ -1079,17 +1079,6 @@ describe Ci::Pipeline, models: true do
end
end
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
describe
'notifications when pipeline success or failed'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
...
...
spec/services/ci/expire_pipeline_cache_service_spec.rb
View file @
9eded57d
...
@@ -16,5 +16,12 @@ describe Ci::ExpirePipelineCacheService, services: true do
...
@@ -16,5 +16,12 @@ describe Ci::ExpirePipelineCacheService, services: true do
subject
.
execute
(
pipeline
)
subject
.
execute
(
pipeline
)
end
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
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment