BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ad61a181
Commit
ad61a181
authored
Mar 21, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support building all pipeline resource before saving
parent
ab0cd2a8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
30 deletions
+36
-30
pipeline.rb
app/models/ci/pipeline.rb
+2
-6
base.rb
lib/gitlab/ci/pipeline/seed/base.rb
+4
-0
build.rb
lib/gitlab/ci/pipeline/seed/build.rb
+12
-5
stage.rb
lib/gitlab/ci/pipeline/seed/stage.rb
+18
-19
No files found.
app/models/ci/pipeline.rb
View file @
ad61a181
...
...
@@ -476,17 +476,13 @@ module Ci
# TODO specs
#
def
protected_ref?
strong_memoize
(
:protected_ref
)
do
project
.
protected_for?
(
ref
)
end
strong_memoize
(
:protected_ref
)
{
project
.
protected_for?
(
ref
)
}
end
# TODO specs
#
def
legacy_trigger
strong_memoize
(
:legacy_trigger
)
do
trigger_requests
.
first
end
strong_memoize
(
:legacy_trigger
)
{
trigger_requests
.
first
}
end
def
predefined_variables
...
...
lib/gitlab/ci/pipeline/seed/base.rb
View file @
ad61a181
...
...
@@ -10,6 +10,10 @@ module Gitlab
def
excluded?
raise
NotImplementedError
end
def
to_resource
raise
NotImplementedError
end
end
end
end
...
...
lib/gitlab/ci/pipeline/seed/build.rb
View file @
ad61a181
...
...
@@ -15,11 +15,18 @@ module Gitlab
end
def
attributes
@attributes
.
merge
(
project:
@pipeline
.
project
,
ref:
@pipeline
.
ref
,
tag:
@pipeline
.
tag
,
trigger_request:
@pipeline
.
legacy_trigger
,
protected:
@pipeline
.
protected_ref?
)
@attributes
.
merge
(
pipeline:
@pipeline
,
project:
@pipeline
.
project
,
ref:
@pipeline
.
ref
,
tag:
@pipeline
.
tag
,
trigger_request:
@pipeline
.
legacy_trigger
,
protected:
@pipeline
.
protected_ref?
)
end
def
to_resource
::
Ci
::
Build
.
new
(
attributes
)
end
end
end
...
...
lib/gitlab/ci/pipeline/seed/stage.rb
View file @
ad61a181
...
...
@@ -3,41 +3,45 @@ module Gitlab
module
Pipeline
module
Seed
class
Stage
<
Seed
::
Base
attr_reader
:pipeline
delegate
:project
,
to: :pipeline
delegate
:size
,
to: :@builds
delegate
:size
,
to: :@seeds
def
initialize
(
pipeline
,
name
,
builds
)
@pipeline
=
pipeline
@name
=
name
@
buil
ds
=
builds
.
map
do
|
attributes
|
Seed
::
Build
.
new
(
pipeline
,
attributes
)
@
see
ds
=
builds
.
map
do
|
attributes
|
Seed
::
Build
.
new
(
@
pipeline
,
attributes
)
end
end
def
user
=
(
current_user
)
@
buil
ds
.
each
{
|
seed
|
seed
.
user
=
current_user
}
@
see
ds
.
each
{
|
seed
|
seed
.
user
=
current_user
}
end
def
attributes
{
name:
@name
,
p
roject:
project
}
{
name:
@name
,
p
ipeline:
@pipeline
,
project:
@pipeline
.
project
}
end
# TODO decouple from Seed::Build
# TODO decouple
#
def
builds_attributes
@builds
.
map
(
&
:attributes
)
@seeds
.
map
(
&
:attributes
)
end
def
to_resource
::
Ci
::
Stage
.
new
(
attributes
)
end
def
create!
pipeline
.
stages
.
build
(
attributes
)
.
tap
do
|
stage
|
builds_attributes
.
each
do
|
build_attributes
|
s
tage
.
builds
.
build
(
build_attributes
)
.
tap
do
|
build
|
build
.
pipeline
=
pipeline
to_resource
.
tap
do
|
stage
|
@seeds
.
each
do
|
seed
|
s
eed
.
to_resource
.
tap
do
|
build
|
stage
.
builds
<<
build
end
end
@pipeline
.
stages
<<
stage
stage
.
save!
stage
.
builds
.
each
do
|
build
|
...
...
@@ -45,11 +49,6 @@ module Gitlab
end
end
end
private
def
protected_ref?
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