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
Léo-Paul Géneau
gitlab-ce
Commits
320b6d96
Commit
320b6d96
authored
Dec 10, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic implementation of CI/CD bridge job
parent
f6d8fb6e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
0 deletions
+125
-0
app/models/ci/bridge.rb
app/models/ci/bridge.rb
+41
-0
lib/gitlab/ci/status/bridge/common.rb
lib/gitlab/ci/status/bridge/common.rb
+27
-0
lib/gitlab/ci/status/bridge/factory.rb
lib/gitlab/ci/status/bridge/factory.rb
+15
-0
spec/factories/ci/bridge.rb
spec/factories/ci/bridge.rb
+17
-0
spec/models/ci/bridge_spec.rb
spec/models/ci/bridge_spec.rb
+25
-0
No files found.
app/models/ci/bridge.rb
0 → 100644
View file @
320b6d96
# frozen_string_literal: true
module
Ci
class
Bridge
<
CommitStatus
include
Importable
include
AfterCommitQueue
include
TokenAuthenticatable
include
Gitlab
::
Utils
::
StrongMemoize
belongs_to
:project
,
inverse_of: :builds
serialize
:options
# rubocop:disable Cop/ActiveRecordSerialize
validates
:ref
,
presence:
true
before_save
:ensure_token
add_authentication_token_field
:token
,
encrypted:
true
def
self
.
retry
(
bridge
,
current_user
)
raise
NotImplementedError
end
def
tags
[
:bridge
]
end
def
detailed_status
(
current_user
)
Gitlab
::
Ci
::
Status
::
Bridge
::
Factory
.
new
(
self
,
current_user
)
.
fabricate!
end
def
predefined_variables
raise
NotImplementedError
end
def
execute_hooks
raise
NotImplementedError
end
end
end
lib/gitlab/ci/status/bridge/common.rb
0 → 100644
View file @
320b6d96
# frozen_string_literal: true
module
Gitlab
module
Ci
module
Status
module
Bridge
module
Common
def
label
subject
.
description
end
def
has_details?
false
end
def
has_action?
false
end
def
details_path
raise
NotImplementedError
end
end
end
end
end
end
lib/gitlab/ci/status/bridge/factory.rb
0 → 100644
View file @
320b6d96
# frozen_string_literal: true
module
Gitlab
module
Ci
module
Status
module
Bridge
class
Factory
<
Status
::
Factory
def
self
.
common_helpers
Status
::
Bridge
::
Common
end
end
end
end
end
end
spec/factories/ci/bridge.rb
0 → 100644
View file @
320b6d96
FactoryBot
.
define
do
factory
:ci_bridge
,
class:
Ci
::
Bridge
do
name
' bridge'
stage
'test'
stage_idx
0
ref
'master'
tag
false
created_at
'Di 29. Okt 09:50:00 CET 2013'
status
:success
pipeline
factory: :ci_pipeline
after
(
:build
)
do
|
bridge
,
evaluator
|
bridge
.
project
||=
bridge
.
pipeline
.
project
end
end
end
spec/models/ci/bridge_spec.rb
0 → 100644
View file @
320b6d96
require
'spec_helper'
describe
Ci
::
Bridge
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:bridge
)
do
create
(
:ci_bridge
,
pipeline:
pipeline
)
end
describe
'#tags'
do
it
'only has a bridge tag'
do
expect
(
bridge
.
tags
).
to
eq
[
:bridge
]
end
end
describe
'#detailed_status'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:status
)
{
bridge
.
detailed_status
(
user
)
}
it
'returns detailed status object'
do
expect
(
status
).
to
be_a
Gitlab
::
Ci
::
Status
::
Success
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