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
bf59ed3c
Commit
bf59ed3c
authored
Mar 23, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify how we set pipeline builds user on creation
parent
713502b0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
34 deletions
+1
-34
lib/gitlab/ci/pipeline/chain/populate.rb
lib/gitlab/ci/pipeline/chain/populate.rb
+0
-2
lib/gitlab/ci/pipeline/seed/build.rb
lib/gitlab/ci/pipeline/seed/build.rb
+1
-8
lib/gitlab/ci/pipeline/seed/stage.rb
lib/gitlab/ci/pipeline/seed/stage.rb
+0
-4
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+0
-10
spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb
spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb
+0
-10
No files found.
lib/gitlab/ci/pipeline/chain/populate.rb
View file @
bf59ed3c
...
@@ -17,8 +17,6 @@ module Gitlab
...
@@ -17,8 +17,6 @@ module Gitlab
# Populate pipeline with all stages and builds from pipeline seeds.
# Populate pipeline with all stages and builds from pipeline seeds.
#
#
pipeline
.
stage_seeds
.
each
do
|
stage
|
pipeline
.
stage_seeds
.
each
do
|
stage
|
stage
.
user
=
current_user
pipeline
.
stages
<<
stage
.
to_resource
pipeline
.
stages
<<
stage
.
to_resource
stage
.
seeds
.
each
do
|
build
|
stage
.
seeds
.
each
do
|
build
|
...
...
lib/gitlab/ci/pipeline/seed/build.rb
View file @
bf59ed3c
...
@@ -17,15 +17,7 @@ module Gitlab
...
@@ -17,15 +17,7 @@ module Gitlab
.
fabricate
(
attributes
.
delete
(
:except
))
.
fabricate
(
attributes
.
delete
(
:except
))
end
end
# TODO, use pipeline.user ?
#
def
user
=
(
current_user
)
@attributes
.
merge!
(
user:
current_user
)
end
def
included?
def
included?
# TODO specs for passing a seed object for lazy resource evaluation
#
strong_memoize
(
:inclusion
)
do
strong_memoize
(
:inclusion
)
do
@only
.
all?
{
|
spec
|
spec
.
satisfied_by?
(
@pipeline
,
self
)
}
&&
@only
.
all?
{
|
spec
|
spec
.
satisfied_by?
(
@pipeline
,
self
)
}
&&
@except
.
none?
{
|
spec
|
spec
.
satisfied_by?
(
@pipeline
,
self
)
}
@except
.
none?
{
|
spec
|
spec
.
satisfied_by?
(
@pipeline
,
self
)
}
...
@@ -36,6 +28,7 @@ module Gitlab
...
@@ -36,6 +28,7 @@ module Gitlab
@attributes
.
merge
(
@attributes
.
merge
(
pipeline:
@pipeline
,
pipeline:
@pipeline
,
project:
@pipeline
.
project
,
project:
@pipeline
.
project
,
user:
@pipeline
.
user
,
ref:
@pipeline
.
ref
,
ref:
@pipeline
.
ref
,
tag:
@pipeline
.
tag
,
tag:
@pipeline
.
tag
,
trigger_request:
@pipeline
.
legacy_trigger
,
trigger_request:
@pipeline
.
legacy_trigger
,
...
...
lib/gitlab/ci/pipeline/seed/stage.rb
View file @
bf59ed3c
...
@@ -17,10 +17,6 @@ module Gitlab
...
@@ -17,10 +17,6 @@ module Gitlab
end
end
end
end
def
user
=
(
current_user
)
@seeds
.
each
{
|
seed
|
seed
.
user
=
current_user
}
end
def
attributes
def
attributes
{
name:
@attributes
.
fetch
(
:name
),
{
name:
@attributes
.
fetch
(
:name
),
pipeline:
@pipeline
,
pipeline:
@pipeline
,
...
...
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
View file @
bf59ed3c
...
@@ -21,16 +21,6 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
...
@@ -21,16 +21,6 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
end
end
end
end
describe
'#user='
do
let
(
:user
)
{
build
(
:user
)
}
it
'assignes user to a build'
do
subject
.
user
=
user
expect
(
subject
.
attributes
).
to
include
(
user:
user
)
end
end
describe
'#to_resource'
do
describe
'#to_resource'
do
it
'returns a valid build resource'
do
it
'returns a valid build resource'
do
expect
(
subject
.
to_resource
).
to
be_a
(
::
Ci
::
Build
)
expect
(
subject
.
to_resource
).
to
be_a
(
::
Ci
::
Build
)
...
...
spec/lib/gitlab/ci/pipeline/seed/stage_spec.rb
View file @
bf59ed3c
...
@@ -95,16 +95,6 @@ describe Gitlab::Ci::Pipeline::Seed::Stage do
...
@@ -95,16 +95,6 @@ describe Gitlab::Ci::Pipeline::Seed::Stage do
end
end
end
end
describe
'#user='
do
let
(
:user
)
{
build
(
:user
)
}
it
'assignes relevant pipeline attributes'
do
subject
.
user
=
user
expect
(
subject
.
seeds
.
map
(
&
:attributes
)).
to
all
(
include
(
user:
user
))
end
end
describe
'#to_resource'
do
describe
'#to_resource'
do
it
'builds a valid stage object with all builds'
do
it
'builds a valid stage object with all builds'
do
subject
.
to_resource
.
save!
subject
.
to_resource
.
save!
...
...
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