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
0884cb30
Commit
0884cb30
authored
Nov 15, 2019
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move needs to Ci::Processable
parent
e36c7247
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
2 deletions
+59
-2
app/models/ci/build.rb
app/models/ci/build.rb
+0
-2
app/models/concerns/ci/processable.rb
app/models/concerns/ci/processable.rb
+8
-0
ee/spec/services/ci/create_pipeline_service/needs_spec.rb
ee/spec/services/ci/create_pipeline_service/needs_spec.rb
+51
-0
No files found.
app/models/ci/build.rb
View file @
0884cb30
...
...
@@ -42,7 +42,6 @@ module Ci
has_one
:deployment
,
as: :deployable
,
class_name:
'Deployment'
has_many
:trace_sections
,
class_name:
'Ci::BuildTraceSection'
has_many
:trace_chunks
,
class_name:
'Ci::BuildTraceChunk'
,
foreign_key: :build_id
has_many
:needs
,
class_name:
'Ci::BuildNeed'
,
foreign_key: :build_id
,
inverse_of: :build
has_many
:job_artifacts
,
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
,
dependent: :destroy
,
inverse_of: :job
# rubocop:disable Cop/ActiveRecordDependent
has_many
:job_variables
,
class_name:
'Ci::JobVariable'
,
foreign_key: :job_id
...
...
@@ -56,7 +55,6 @@ module Ci
accepts_nested_attributes_for
:runner_session
accepts_nested_attributes_for
:job_variables
accepts_nested_attributes_for
:needs
delegate
:url
,
to: :runner_session
,
prefix:
true
,
allow_nil:
true
delegate
:terminal_specification
,
to: :runner_session
,
allow_nil:
true
...
...
app/models/concerns/ci/processable.rb
View file @
0884cb30
...
...
@@ -8,6 +8,14 @@ module Ci
#
#
module
Processable
extend
ActiveSupport
::
Concern
included
do
has_many
:needs
,
class_name:
'Ci::BuildNeed'
,
foreign_key: :build_id
,
inverse_of: :build
accepts_nested_attributes_for
:needs
end
def
schedulable?
raise
NotImplementedError
end
...
...
ee/spec/services/ci/create_pipeline_service/needs_spec.rb
0 → 100644
View file @
0884cb30
# frozen_string_literal: true
require
'spec_helper'
describe
Ci
::
CreatePipelineService
do
subject
(
:execute
)
{
service
.
execute
(
:push
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:admin
)
}
let
(
:service
)
{
described_class
.
new
(
project
,
user
,
{
ref:
'refs/heads/master'
})
}
let
(
:config
)
do
<<~
EOY
regular_job:
stage: build
script:
- echo 'hello'
bridge_dag_job:
stage: test
needs:
- regular_job
trigger: 'some/project'
EOY
end
before
do
stub_ci_pipeline_yaml_file
(
config
)
end
it
'persists pipeline'
do
expect
(
execute
).
to
be_persisted
end
it
'persists both jobs'
do
expect
{
execute
}.
to
change
(
Ci
::
Build
,
:count
).
from
(
0
).
to
(
1
)
.
and
change
(
Ci
::
Bridge
,
:count
).
from
(
0
).
to
(
1
)
end
it
'persists bridge needs'
do
job
=
execute
.
builds
.
first
bridge
=
execute
.
stages
.
last
.
bridges
.
first
expect
(
bridge
.
needs
.
first
.
name
).
to
eq
(
job
.
name
)
end
it
'persists bridge target project'
do
bridge
=
execute
.
stages
.
last
.
bridges
.
first
expect
(
bridge
.
downstream_project
).
to
eq
(
'some/project'
)
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