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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
4b249d52
Commit
4b249d52
authored
Mar 14, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the pipeline cache when updating a pipeline-status
parent
e36f4449
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+6
-0
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+13
-0
No files found.
app/models/ci/pipeline.rb
View file @
4b249d52
...
@@ -22,6 +22,7 @@ module Ci
...
@@ -22,6 +22,7 @@ module Ci
validate
:valid_commit_sha
,
unless: :importing?
validate
:valid_commit_sha
,
unless: :importing?
after_create
:keep_around_commits
,
unless: :importing?
after_create
:keep_around_commits
,
unless: :importing?
after_create
:refresh_build_status_cache
state_machine
:status
,
initial: :created
do
state_machine
:status
,
initial: :created
do
event
:enqueue
do
event
:enqueue
do
...
@@ -328,6 +329,7 @@ module Ci
...
@@ -328,6 +329,7 @@ module Ci
when
'manual'
then
block
when
'manual'
then
block
end
end
end
end
refresh_build_status_cache
end
end
def
predefined_variables
def
predefined_variables
...
@@ -369,6 +371,10 @@ module Ci
...
@@ -369,6 +371,10 @@ module Ci
.
fabricate!
.
fabricate!
end
end
def
refresh_build_status_cache
Ci
::
PipelineStatus
.
new
(
project
,
sha:
sha
,
status:
status
).
store_in_cache_if_needed
end
private
private
def
pipeline_data
def
pipeline_data
...
...
spec/models/ci/pipeline_spec.rb
View file @
4b249d52
...
@@ -1018,6 +1018,19 @@ describe Ci::Pipeline, models: true do
...
@@ -1018,6 +1018,19 @@ describe Ci::Pipeline, models: true do
end
end
end
end
describe
'#update_status'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
sha:
'123456'
)
}
it
'updates the cached status'
do
fake_status
=
double
# after updating the status, the status is set to `skipped` for this pipeline's builds
expect
(
Ci
::
PipelineStatus
).
to
receive
(
:new
).
with
(
pipeline
.
project
,
sha:
'123456'
,
status:
'skipped'
).
and_return
(
fake_status
)
expect
(
fake_status
).
to
receive
(
:store_in_cache_if_needed
)
pipeline
.
update_status
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
)
}
...
...
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