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
2d495fce
Commit
2d495fce
authored
Jun 15, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove reduntant method for building pipeline builds
parent
69112072
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
9 deletions
+12
-9
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+5
-7
app/services/ci/create_builds_service.rb
app/services/ci/create_builds_service.rb
+2
-1
app/services/create_commit_builds_service.rb
app/services/create_commit_builds_service.rb
+1
-1
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+3
-0
spec/services/create_commit_builds_service_spec.rb
spec/services/create_commit_builds_service_spec.rb
+1
-0
No files found.
app/models/ci/pipeline.rb
View file @
2d495fce
...
@@ -91,15 +91,14 @@ module Ci
...
@@ -91,15 +91,14 @@ module Ci
trigger_requests
.
any?
trigger_requests
.
any?
end
end
def
build_builds
(
user
,
trigger_request
=
nil
)
def
create_builds
(
user
,
trigger_request
=
nil
)
##
# We persist pipeline only if there are builds available
#
return
unless
config_processor
return
unless
config_processor
build_builds_for_stages
(
config_processor
.
stages
,
user
,
build_builds_for_stages
(
config_processor
.
stages
,
user
,
'success'
,
trigger_request
)
'success'
,
trigger_request
)
&&
save
end
def
create_builds
(
user
,
trigger_request
=
nil
)
build_builds
(
user
,
trigger_request
)
&&
save
end
end
def
create_next_builds
(
build
)
def
create_next_builds
(
build
)
...
@@ -121,7 +120,6 @@ module Ci
...
@@ -121,7 +120,6 @@ module Ci
# and save pipeline if we have builds
# and save pipeline if we have builds
build_builds_for_stages
(
next_stages
,
build
.
user
,
prior_status
,
build_builds_for_stages
(
next_stages
,
build
.
user
,
prior_status
,
build
.
trigger_request
)
&&
save
build
.
trigger_request
)
&&
save
end
end
def
retried
def
retried
...
...
app/services/ci/create_builds_service.rb
View file @
2d495fce
...
@@ -22,7 +22,8 @@ module Ci
...
@@ -22,7 +22,8 @@ module Ci
# don't create the same build twice
# don't create the same build twice
builds_attrs
.
reject!
do
|
build_attrs
|
builds_attrs
.
reject!
do
|
build_attrs
|
@pipeline
.
builds
.
find_by
(
ref:
@pipeline
.
ref
,
tag:
@pipeline
.
tag
,
@pipeline
.
builds
.
find_by
(
ref:
@pipeline
.
ref
,
tag:
@pipeline
.
tag
,
trigger_request:
trigger_request
,
trigger_request:
trigger_request
,
name:
build_attrs
[
:name
])
name:
build_attrs
[
:name
])
end
end
...
...
app/services/create_commit_builds_service.rb
View file @
2d495fce
...
@@ -42,7 +42,7 @@ class CreateCommitBuildsService
...
@@ -42,7 +42,7 @@ class CreateCommitBuildsService
##
##
# Skip creating pipeline object if there are no builds for it.
# Skip creating pipeline object if there are no builds for it.
#
#
unless
@pipeline
.
build
_builds
(
user
)
unless
@pipeline
.
create
_builds
(
user
)
@pipeline
.
errors
.
add
(
:base
,
'No builds created'
)
@pipeline
.
errors
.
add
(
:base
,
'No builds created'
)
return
false
return
false
end
end
...
...
spec/models/ci/pipeline_spec.rb
View file @
2d495fce
...
@@ -260,12 +260,15 @@ describe Ci::Pipeline, models: true do
...
@@ -260,12 +260,15 @@ describe Ci::Pipeline, models: true do
end
end
context
'when no builds created'
do
context
'when no builds created'
do
let
(
:pipeline
)
{
build
(
:ci_pipeline
)
}
before
do
before
do
stub_ci_pipeline_yaml_file
(
YAML
.
dump
(
before_script:
[
'ls'
]))
stub_ci_pipeline_yaml_file
(
YAML
.
dump
(
before_script:
[
'ls'
]))
end
end
it
'returns false'
do
it
'returns false'
do
expect
(
pipeline
.
create_builds
(
nil
)).
to
be_falsey
expect
(
pipeline
.
create_builds
(
nil
)).
to
be_falsey
expect
(
pipeline
).
not_to
be_persisted
end
end
end
end
end
end
...
...
spec/services/create_commit_builds_service_spec.rb
View file @
2d495fce
...
@@ -184,6 +184,7 @@ describe CreateCommitBuildsService, services: true do
...
@@ -184,6 +184,7 @@ describe CreateCommitBuildsService, services: true do
before:
'00000000'
,
before:
'00000000'
,
after:
'31das312'
,
after:
'31das312'
,
commits:
[{
message:
'some msg'
}])
commits:
[{
message:
'some msg'
}])
expect
(
result
).
to
be_falsey
expect
(
result
).
to
be_falsey
expect
(
Ci
::
Build
.
all
).
to
be_empty
expect
(
Ci
::
Build
.
all
).
to
be_empty
expect
(
Ci
::
Pipeline
.
count
).
to
eq
(
0
)
expect
(
Ci
::
Pipeline
.
count
).
to
eq
(
0
)
...
...
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