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
5ee1bd04
Commit
5ee1bd04
authored
Jul 12, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle running statuses when mirroring status
Handles 'running' status when mirror pipeline status to bridged job.
parent
2f418b77
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
7 deletions
+30
-7
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+4
-0
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+2
-2
ee/app/models/ee/ci/bridge.rb
ee/app/models/ee/ci/bridge.rb
+7
-2
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+1
-1
ee/app/services/ci/pipeline_bridge_status_service.rb
ee/app/services/ci/pipeline_bridge_status_service.rb
+7
-1
ee/app/services/ci/subscribe_bridge_service.rb
ee/app/services/ci/subscribe_bridge_service.rb
+1
-1
ee/spec/services/ci/pipeline_bridge_status_service_spec.rb
ee/spec/services/ci/pipeline_bridge_status_service_spec.rb
+8
-0
No files found.
app/models/ci/pipeline.rb
View file @
5ee1bd04
...
...
@@ -328,6 +328,10 @@ module Ci
config_sources
.
values_at
(
:repository_source
,
:auto_devops_source
,
:unknown_source
)
end
def
self
.
bridgeable_statuses
::
Ci
::
Pipeline
.
all_statuses
-
[
:created
,
:preparing
,
:pending
]
end
def
stages_count
statuses
.
select
(
:stage
).
distinct
.
count
end
...
...
app/models/concerns/has_status.rb
View file @
5ee1bd04
...
...
@@ -73,8 +73,8 @@ module HasStatus
COMPLETED_STATUSES
.
map
(
&
:to_sym
)
end
def
blocked
_statuses
BLOCKED_STATU
S
.
map
(
&
:to_sym
)
def
all
_statuses
AVAILABLE_STATUSE
S
.
map
(
&
:to_sym
)
end
end
...
...
ee/app/models/ee/ci/bridge.rb
View file @
5ee1bd04
...
...
@@ -4,6 +4,7 @@ module EE
module
Ci
module
Bridge
extend
ActiveSupport
::
Concern
include
::
Gitlab
::
Utils
::
StrongMemoize
InvalidBridgeTypeError
=
Class
.
new
(
StandardError
)
...
...
@@ -57,11 +58,15 @@ module EE
end
def
downstream_project
options
&
.
dig
(
:trigger
,
:project
)
strong_memoize
(
:downstream_project
)
do
options
&
.
dig
(
:trigger
,
:project
)
end
end
def
upstream_project
options
&
.
dig
(
:needs
,
:pipeline
)
strong_memoize
(
:upstream_project
)
do
options
&
.
dig
(
:needs
,
:pipeline
)
end
end
def
target_ref
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
5ee1bd04
...
...
@@ -97,7 +97,7 @@ module EE
end
end
after_transition
any
=>
::
Ci
::
Pipeline
.
completed_statuses
+
::
Ci
::
Pipeline
.
blocked
_statuses
do
|
pipeline
|
after_transition
any
=>
::
Ci
::
Pipeline
.
bridgeable
_statuses
do
|
pipeline
|
next
unless
pipeline
.
downstream_bridges
.
any?
pipeline
.
run_after_commit
do
...
...
ee/app/services/ci/pipeline_bridge_status_service.rb
View file @
5ee1bd04
...
...
@@ -2,6 +2,8 @@
module
Ci
class
PipelineBridgeStatusService
<
::
BaseService
InvalidUpstreamStatusError
=
Class
.
new
(
StandardError
)
def
execute
(
pipeline
)
pipeline
.
downstream_bridges
.
each
do
|
bridge
|
process_bridge
(
pipeline
.
status
,
bridge
)
...
...
@@ -18,10 +20,14 @@ module Ci
bridge
.
cancel!
when
'skipped'
bridge
.
skip!
when
'running'
bridge
.
run!
when
'manual'
bridge
.
update
(
status:
'manual'
)
when
'scheduled'
bridge
.
schedule!
bridge
.
update
(
status:
'scheduled'
)
else
raise
InvalidUpstreamStatusError
end
end
end
...
...
ee/app/services/ci/subscribe_bridge_service.rb
View file @
5ee1bd04
...
...
@@ -21,7 +21,7 @@ module Ci
bridge_updates
=
{
upstream_pipeline:
upstream_pipeline
}
if
upstream_pipeline
.
complete?
||
upstream_pipeline
.
blocked?
if
::
Ci
::
Pipeline
.
bridgeable_statuses
.
include?
(
upstream_pipeline
.
status
.
to_sym
)
bridge_updates
[
:status
]
=
upstream_pipeline
.
status
end
...
...
ee/spec/services/ci/pipeline_bridge_status_service_spec.rb
View file @
5ee1bd04
...
...
@@ -17,6 +17,14 @@ describe Ci::PipelineBridgeStatusService do
pipeline
.
downstream_bridges
<<
bridge
end
context
'when pipeline starts running'
do
let
(
:status
)
{
:running
}
it
'updates the bridge status with the pipeline status'
do
expect
{
subject
}.
to
change
{
bridge
.
status
}.
from
(
'pending'
).
to
(
'running'
)
end
end
context
'when pipeline succeeds'
do
let
(
:status
)
{
:success
}
...
...
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