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
4d0032f0
Commit
4d0032f0
authored
Apr 20, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run PipelineBridgeWorker after Pipeline finishes
parent
dd73af2e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+4
-0
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+9
-1
ee/spec/models/ci/pipeline_spec.rb
ee/spec/models/ci/pipeline_spec.rb
+13
-0
No files found.
app/models/concerns/has_status.rb
View file @
4d0032f0
...
...
@@ -66,6 +66,10 @@ module HasStatus
def
all_state_names
state_machines
.
values
.
flat_map
(
&
:states
).
flat_map
{
|
s
|
s
.
map
(
&
:name
)
}
end
def
completed_statuses
COMPLETED_STATUSES
.
map
(
&
:to_sym
)
end
end
included
do
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
4d0032f0
...
...
@@ -88,7 +88,7 @@ module EE
}.
freeze
state_machine
:status
do
after_transition
any
=>
::
Ci
::
Pipeline
::
COMPLETED_STATUSES
.
map
(
&
:to_sym
)
do
|
pipeline
|
after_transition
any
=>
::
Ci
::
Pipeline
.
completed_statuses
do
|
pipeline
|
next
unless
pipeline
.
has_reports?
(
::
Ci
::
JobArtifact
.
security_reports
)
&&
pipeline
.
default_branch?
pipeline
.
run_after_commit
do
...
...
@@ -96,6 +96,14 @@ module EE
end
end
after_transition
any
=>
::
Ci
::
Pipeline
.
completed_statuses
do
|
pipeline
|
next
unless
pipeline
.
bridged_jobs
.
any?
pipeline
.
run_after_commit
do
::
Ci
::
PipelineBridgeWorker
.
perform_async
(
pipeline
.
id
)
end
end
after_transition
created: :pending
do
|
pipeline
|
next
unless
pipeline
.
bridge_triggered?
...
...
ee/spec/models/ci/pipeline_spec.rb
View file @
4d0032f0
...
...
@@ -440,6 +440,19 @@ describe Ci::Pipeline do
end
end
end
context
'when pipeline has bridged jobs'
do
before
do
pipeline
.
bridged_jobs
<<
create
(
:ci_bridge
)
end
context
"when transitioning to success"
do
it
'schedules the pipeline bridge worker'
do
expect
(
::
Ci
::
PipelineBridgeWorker
).
to
receive
(
:perform_async
).
with
(
pipeline
.
id
)
pipeline
.
succeed!
end
end
end
end
describe
'#ci_yaml_file_path'
do
...
...
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