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
820eeaf6
Commit
820eeaf6
authored
Dec 12, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scaffold of EE extensions to CI/CD bridge jobs
parent
b7c0076e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
0 deletions
+64
-0
app/models/ci/bridge.rb
app/models/ci/bridge.rb
+2
-0
ee/app/models/ee/ci/bridge.rb
ee/app/models/ee/ci/bridge.rb
+38
-0
ee/spec/models/ci/bridge_spec.rb
ee/spec/models/ci/bridge_spec.rb
+24
-0
No files found.
app/models/ci/bridge.rb
View file @
820eeaf6
...
...
@@ -32,3 +32,5 @@ module Ci
end
end
end
::
Ci
::
Bridge
.
prepend
(
::
EE
::
Ci
::
Bridge
)
ee/app/models/ee/ci/bridge.rb
0 → 100644
View file @
820eeaf6
# frozen_string_literal: true
module
EE
module
Ci
module
Bridge
extend
ActiveSupport
::
Concern
prepended
do
has_many
:sourced_pipelines
,
class_name:
::
Ci
::
Sources
::
Pipeline
,
foreign_key: :source_job_id
state_machine
:status
do
after_transition
any
=>
[
:pending
]
do
|
bridge
|
bridge
.
run_after_commit
do
bridge
.
schedule_downstream_pipeline!
# 1. schedule pipeline creation async
# 2. scheduled pipeline calls-back to change state to running
# when it gets created successfully
# 3. if no downstream pipeline can not be created because of
# various reasons like lack of access then we change state to
# failed with a reason
end
end
after_transition
pending: :running
do
|
bridge
|
bridge
.
run_after_commit
do
end
end
end
end
def
schedule_downstream_pipeline!
raise
NotImplementedError
end
end
end
end
ee/spec/models/ci/bridge_spec.rb
0 → 100644
View file @
820eeaf6
require
'spec_helper'
describe
Ci
::
Bridge
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:bridge
)
do
create
(
:ci_bridge
,
status: :created
,
pipeline:
pipeline
)
end
it
'has many sourced pipelines'
do
expect
(
bridge
).
to
have_many
(
:sourced_pipelines
)
end
describe
'state machine transitions'
do
context
'when it changes status from created to pending'
do
it
'schedules downstream pipeline creation'
do
expect
(
bridge
).
to
receive
(
:schedule_downstream_pipeline!
)
bridge
.
enqueue!
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