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
95028cb2
Commit
95028cb2
authored
Aug 12, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ce_upstream' of gitlab.com:gitlab-org/gitlab-ee into ce_upstream
parents
f2da64a9
26d9d312
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
129 deletions
+9
-129
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+6
-1
app/services/create_commit_builds_service.rb
app/services/create_commit_builds_service.rb
+0
-72
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-6
app/services/git_tag_push_service.rb
app/services/git_tag_push_service.rb
+1
-10
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+1
-15
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+0
-25
No files found.
app/services/ci/create_pipeline_service.rb
View file @
95028cb2
...
...
@@ -2,7 +2,8 @@ module Ci
class
CreatePipelineService
<
BaseService
attr_reader
:pipeline
def
execute
(
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
)
def
execute
(
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
,
mirror_update:
false
)
@pipeline
=
Ci
::
Pipeline
.
new
(
project:
project
,
ref:
ref
,
...
...
@@ -17,6 +18,10 @@ module Ci
return
error
(
'Pipeline is disabled'
)
end
unless
project
.
mirror_trigger_builds?
return
error
(
'Pipeline is disabled for mirror updates'
)
if
mirror_update
end
unless
trigger_request
||
can?
(
current_user
,
:create_pipeline
,
project
)
return
error
(
'Insufficient permissions to create a new pipeline'
)
end
...
...
app/services/create_commit_builds_service.rb
deleted
100644 → 0
View file @
f2da64a9
class
CreateCommitBuildsService
def
execute
(
project
,
user
,
params
,
mirror_update:
false
)
return
unless
project
.
builds_enabled?
return
false
if
!
project
.
mirror_trigger_builds?
&&
mirror_update
before_sha
=
params
[
:checkout_sha
]
||
params
[
:before
]
sha
=
params
[
:checkout_sha
]
||
params
[
:after
]
origin_ref
=
params
[
:ref
]
ref
=
Gitlab
::
Git
.
ref_name
(
origin_ref
)
tag
=
Gitlab
::
Git
.
tag_ref?
(
origin_ref
)
# Skip branch removal
if
sha
==
Gitlab
::
Git
::
BLANK_SHA
return
false
end
@pipeline
=
Ci
::
Pipeline
.
new
(
project:
project
,
sha:
sha
,
ref:
ref
,
before_sha:
before_sha
,
tag:
tag
,
user:
user
)
##
# Skip creating pipeline if no gitlab-ci.yml is found
#
unless
@pipeline
.
ci_yaml_file
return
false
end
##
# Skip creating builds for commits that have [ci skip]
# but save pipeline object
#
if
@pipeline
.
skip_ci?
return
save_pipeline!
end
##
# Skip creating builds when CI config is invalid
# but save pipeline object
#
unless
@pipeline
.
config_processor
return
save_pipeline!
end
##
# Skip creating pipeline object if there are no builds for it.
#
unless
@pipeline
.
create_builds
(
user
)
@pipeline
.
errors
.
add
(
:base
,
'No builds created'
)
return
false
end
save_pipeline!
end
private
##
# Create a new pipeline and touch object to calculate status
#
def
save_pipeline!
@pipeline
.
save!
@pipeline
.
touch
@pipeline
end
end
app/services/git_push_service.rb
View file @
95028cb2
...
...
@@ -74,12 +74,7 @@ class GitPushService < BaseService
SystemHooksService
.
new
.
execute_hooks
(
build_push_data_system_hook
.
dup
,
:push_hooks
)
@project
.
execute_hooks
(
build_push_data
.
dup
,
:push_hooks
)
@project
.
execute_services
(
build_push_data
.
dup
,
:push_hooks
)
<<<<<<<
HEAD
CreateCommitBuildsService
.
new
.
execute
(
@project
,
current_user
,
build_push_data
,
mirror_update:
mirror_update
)
=======
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
build_push_data
).
execute
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
build_push_data
).
execute
(
mirror_update:
mirror_update
)
ProjectCacheWorker
.
perform_async
(
@project
.
id
)
end
...
...
app/services/git_tag_push_service.rb
View file @
95028cb2
...
...
@@ -11,16 +11,7 @@ class GitTagPushService < BaseService
SystemHooksService
.
new
.
execute_hooks
(
build_system_push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_hooks
(
@push_data
.
dup
,
:tag_push_hooks
)
project
.
execute_services
(
@push_data
.
dup
,
:tag_push_hooks
)
<<<<<<<
HEAD
CreateCommitBuildsService
.
new
.
execute
(
project
,
current_user
,
@push_data
,
mirror_update:
params
[
:mirror_update
]
)
=======
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
@push_data
).
execute
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
Ci
::
CreatePipelineService
.
new
(
project
,
current_user
,
@push_data
).
execute
(
mirror_update:
params
[
:mirror_update
])
ProjectCacheWorker
.
perform_async
(
project
.
id
)
true
...
...
spec/models/ci/pipeline_spec.rb
View file @
95028cb2
...
...
@@ -139,16 +139,8 @@ describe Ci::Pipeline, models: true do
end
end
<<<<<<<
HEAD
describe
'#update_state'
do
it
'executes update_state after touching object'
do
expect
(
pipeline
).
to
receive
(
:update_state
).
and_return
(
true
)
pipeline
.
touch
end
=======
describe
'#reload_status!'
do
let
(
:pipeline
)
{
create
:ci_empty_pipeline
,
project:
project
}
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
context
'dependent objects'
do
let
(
:commit_status
)
{
create
:commit_status
,
:pending
,
pipeline:
pipeline
}
...
...
@@ -156,15 +148,9 @@ describe Ci::Pipeline, models: true do
it
'executes reload_status! after succeeding dependent object'
do
expect
(
pipeline
).
to
receive
(
:reload_status!
).
and_return
(
true
)
<<<<<<<
HEAD
it
'executes update_state after saving dependent object'
do
expect
(
pipeline
).
to
receive
(
:update_state
).
and_return
(
true
)
commit_status
.
save
=======
commit_status
.
success
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
end
end
end
s
context
'updates'
do
let
(
:current
)
{
Time
.
now
.
change
(
usec:
0
)
}
...
...
spec/requests/ci/api/builds_spec.rb
View file @
95028cb2
...
...
@@ -14,14 +14,7 @@ describe Ci::API::API do
end
describe
"POST /builds/register"
do
<<<<<<<
HEAD
it
"starts a build"
do
pipeline
=
FactoryGirl
.
create
(
:ci_pipeline
,
project:
project
,
ref:
'master'
)
pipeline
.
create_builds
(
nil
)
build
=
pipeline
.
builds
.
first
=======
let!
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'spinach'
,
stage:
'test'
,
stage_idx:
0
)
}
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
it
"starts a build"
do
register_builds
info:
{
platform: :darwin
}
...
...
@@ -37,22 +30,10 @@ describe Ci::API::API do
)
end
<<<<<<<
HEAD
it
"returns 404 error if no pending build found"
do
post
ci_api
(
"/builds/register"
),
token:
runner
.
token
expect
(
response
).
to
have_http_status
(
404
)
end
it
"returns 404 error if no builds for specific runner"
do
pipeline
=
FactoryGirl
.
create
(
:ci_pipeline
,
project:
shared_project
)
FactoryGirl
.
create
(
:ci_build
,
pipeline:
pipeline
,
status:
'pending'
)
=======
context
'when builds are finished'
do
before
do
build
.
success
end
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
it
"returns 404 error if no builds for specific runner"
do
register_builds
...
...
@@ -61,17 +42,11 @@ describe Ci::API::API do
end
end
<<<<<<<
HEAD
it
"returns 404 error if no builds for shared runner"
do
pipeline
=
FactoryGirl
.
create
(
:ci_pipeline
,
project:
project
)
FactoryGirl
.
create
(
:ci_build
,
pipeline:
pipeline
,
status:
'pending'
)
=======
context
'for other project with builds'
do
before
do
build
.
success
create
(
:ci_build
,
:pending
)
end
>>>>>>>
5
a33bc984abfb4ee6243c00bbcc71ccd086d2266
it
"returns 404 error if no builds for shared runner"
do
register_builds
...
...
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