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
9fcba59b
Commit
9fcba59b
authored
Jun 07, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
bf20a3aa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
20 deletions
+10
-20
app/models/ci/sources/pipeline.rb
app/models/ci/sources/pipeline.rb
+0
-10
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+2
-6
app/services/ci/pipeline_trigger_service.rb
app/services/ci/pipeline_trigger_service.rb
+5
-1
spec/requests/api/triggers_spec.rb
spec/requests/api/triggers_spec.rb
+3
-3
No files found.
app/models/ci/sources/pipeline.rb
View file @
9fcba59b
...
...
@@ -16,16 +16,6 @@ module Ci
validates
:source_project
,
presence:
true
validates
:source_job
,
presence:
true
validates
:source_pipeline
,
presence:
true
before_validation
:set_dependent_objects
private
def
set_dependent_objects
project
||=
pipeline
.
project
source_pipeline
||=
source_job
.
pipeline
source_project
||=
source_pipeline
.
project
end
end
end
end
app/services/ci/create_pipeline_service.rb
View file @
9fcba59b
...
...
@@ -51,12 +51,6 @@ module Ci
return
error
(
'No builds for this pipeline.'
)
end
_create_pipeline
end
private
def
_create_pipeline
Ci
::
Pipeline
.
transaction
do
update_merge_requests_head_pipeline
if
pipeline
.
save
...
...
@@ -72,6 +66,8 @@ module Ci
pipeline
.
tap
(
&
:process!
)
end
private
def
update_merge_requests_head_pipeline
return
unless
pipeline
.
latest?
...
...
app/services/ci/pipeline_trigger_service.rb
View file @
9fcba59b
...
...
@@ -34,7 +34,11 @@ module Ci
pipeline
=
Ci
::
CreatePipelineService
.
new
(
project
,
job
.
user
,
ref:
params
[
:ref
]).
execute
(
:pipeline
,
ignore_skip_ci:
true
)
do
|
pipeline
|
job
.
sourced_pipelines
.
create!
(
pipeline:
pipeline
)
job
.
sourced_pipelines
.
create!
(
source_pipeline:
job
.
pipeline
,
source_project:
job
.
project
,
pipeline:
pipeline
,
project:
project
)
end
if
pipeline
.
persisted?
...
...
spec/requests/api/triggers_spec.rb
View file @
9fcba59b
...
...
@@ -55,7 +55,7 @@ describe API::Triggers do
post
api
(
"/projects/
#{
project
.
id
}
/trigger/pipeline"
),
options
.
merge
(
ref:
'other-branch'
)
expect
(
response
).
to
have_http_status
(
400
)
expect
(
json_response
[
'message'
]).
to
eq
(
'
No pipeline created'
)
expect
(
json_response
[
'message'
]).
to
eq
(
'
base'
=>
[
"Reference not found"
]
)
end
context
'Validates variables'
do
...
...
@@ -87,8 +87,8 @@ describe API::Triggers do
end
context
'when triggering a pipeline from a trigger token'
do
it
'does not leak the presence of project when
using valid token
'
do
post
api
(
"/projects/
#{
project
.
id
}
/ref/master/trigger/pipeline?token=
#{
trigger_token
}
"
),
{
ref:
'refs/heads/other-branch'
}
it
'does not leak the presence of project when
token is for different project
'
do
post
api
(
"/projects/
#{
project
2
.
id
}
/ref/master/trigger/pipeline?token=
#{
trigger_token
}
"
),
{
ref:
'refs/heads/other-branch'
}
expect
(
response
).
to
have_http_status
(
404
)
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