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
0d19abf4
Commit
0d19abf4
authored
Jun 02, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add minor improvements in create builds service
parent
1bcb61dd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
10 deletions
+8
-10
commit.rb
app/models/ci/commit.rb
+1
-1
create_builds_service.rb
app/services/ci/create_builds_service.rb
+2
-7
gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+4
-1
create_commit_builds_service_spec.rb
spec/services/create_commit_builds_service_spec.rb
+1
-1
No files found.
app/models/ci/commit.rb
View file @
0d19abf4
...
@@ -135,7 +135,7 @@ module Ci
...
@@ -135,7 +135,7 @@ module Ci
@config_processor
||=
begin
@config_processor
||=
begin
Ci
::
GitlabCiYamlProcessor
.
new
(
ci_yaml_file
,
project
.
path_with_namespace
)
Ci
::
GitlabCiYamlProcessor
.
new
(
ci_yaml_file
,
project
.
path_with_namespace
)
rescue
Ci
::
GitlabCiYamlProcessor
::
ValidationError
,
Psych
::
SyntaxError
=>
e
rescue
Ci
::
GitlabCiYamlProcessor
::
ValidationError
,
Psych
::
SyntaxError
=>
e
self
.
yaml_errors
=
(
e
.
message
)
self
.
yaml_errors
=
e
.
message
nil
nil
rescue
rescue
self
.
yaml_errors
=
'Undefined error'
self
.
yaml_errors
=
'Undefined error'
...
...
app/services/ci/create_builds_service.rb
View file @
0d19abf4
...
@@ -2,10 +2,11 @@ module Ci
...
@@ -2,10 +2,11 @@ module Ci
class
CreateBuildsService
class
CreateBuildsService
def
initialize
(
commit
)
def
initialize
(
commit
)
@commit
=
commit
@commit
=
commit
@config
=
commit
.
config_processor
end
end
def
execute
(
stage
,
user
,
status
,
trigger_request
=
nil
)
def
execute
(
stage
,
user
,
status
,
trigger_request
=
nil
)
builds_attrs
=
config_processor
.
builds_for_stage_and_ref
(
stage
,
@commit
.
ref
,
@commit
.
tag
,
trigger_request
)
builds_attrs
=
@config
.
builds_for_stage_and_ref
(
stage
,
@commit
.
ref
,
@commit
.
tag
,
trigger_request
)
# check when to create next build
# check when to create next build
builds_attrs
=
builds_attrs
.
select
do
|
build_attrs
|
builds_attrs
=
builds_attrs
.
select
do
|
build_attrs
|
...
@@ -41,11 +42,5 @@ module Ci
...
@@ -41,11 +42,5 @@ module Ci
end
end
end
end
end
end
private
def
config_processor
@config_processor
||=
@commit
.
config_processor
end
end
end
end
end
lib/ci/gitlab_ci_yaml_processor.rb
View file @
0d19abf4
...
@@ -27,7 +27,10 @@ module Ci
...
@@ -27,7 +27,10 @@ module Ci
end
end
def
builds_for_stage_and_ref
(
stage
,
ref
,
tag
=
false
,
trigger_request
=
nil
)
def
builds_for_stage_and_ref
(
stage
,
ref
,
tag
=
false
,
trigger_request
=
nil
)
builds
.
select
{
|
build
|
build
[
:stage
]
==
stage
&&
process?
(
build
[
:only
],
build
[
:except
],
ref
,
tag
,
trigger_request
)}
builds
.
select
do
|
build
|
build
[
:stage
]
==
stage
&&
process?
(
build
[
:only
],
build
[
:except
],
ref
,
tag
,
trigger_request
)
end
end
end
def
builds
def
builds
...
...
spec/services/create_commit_builds_service_spec.rb
View file @
0d19abf4
...
@@ -183,7 +183,7 @@ describe CreateCommitBuildsService, services: true do
...
@@ -183,7 +183,7 @@ describe CreateCommitBuildsService, services: true do
ref:
'refs/heads/master'
,
ref:
'refs/heads/master'
,
before:
'00000000'
,
before:
'00000000'
,
after:
'31das312'
,
after:
'31das312'
,
commits:
[{
message:
'some msg'
}])
commits:
[{
message:
'some msg'
}
])
expect
(
result
).
to
be
false
expect
(
result
).
to
be
false
expect
(
Ci
::
Build
.
all
).
to
be_empty
expect
(
Ci
::
Build
.
all
).
to
be_empty
...
...
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