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
f9719fa3
Commit
f9719fa3
authored
Jan 22, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
66391a5c
f02be29e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
1 deletion
+34
-1
changelogs/unreleased/55966-when-ref-is-ambiguous-createpipelineservice-raises-an-error.yml
...ef-is-ambiguous-createpipelineservice-raises-an-error.yml
+5
-0
lib/gitlab/ci/pipeline/chain/build.rb
lib/gitlab/ci/pipeline/chain/build.rb
+0
-1
lib/gitlab/ci/pipeline/chain/populate.rb
lib/gitlab/ci/pipeline/chain/populate.rb
+4
-0
spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
+25
-0
No files found.
changelogs/unreleased/55966-when-ref-is-ambiguous-createpipelineservice-raises-an-error.yml
0 → 100644
View file @
f9719fa3
---
title
:
Prevent checking protected_ref? for ambiguous refs.
merge_request
:
24437
author
:
type
:
fixed
lib/gitlab/ci/pipeline/chain/build.rb
View file @
f9719fa3
...
@@ -17,7 +17,6 @@ module Gitlab
...
@@ -17,7 +17,6 @@ module Gitlab
user:
@command
.
current_user
,
user:
@command
.
current_user
,
pipeline_schedule:
@command
.
schedule
,
pipeline_schedule:
@command
.
schedule
,
merge_request:
@command
.
merge_request
,
merge_request:
@command
.
merge_request
,
protected:
@command
.
protected_ref?
,
variables_attributes:
Array
(
@command
.
variables_attributes
)
variables_attributes:
Array
(
@command
.
variables_attributes
)
)
)
...
...
lib/gitlab/ci/pipeline/chain/populate.rb
View file @
f9719fa3
...
@@ -13,6 +13,10 @@ module Gitlab
...
@@ -13,6 +13,10 @@ module Gitlab
# Allocate next IID. This operation must be outside of transactions of pipeline creations.
# Allocate next IID. This operation must be outside of transactions of pipeline creations.
pipeline
.
ensure_project_iid!
pipeline
.
ensure_project_iid!
# Protect the pipeline. This is assigned in Populate instead of
# Build to prevent erroring out on ambiguous refs.
pipeline
.
protected
=
@command
.
protected_ref?
##
##
# Populate pipeline with block argument of CreatePipelineService#execute.
# Populate pipeline with block argument of CreatePipelineService#execute.
#
#
...
...
spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
View file @
f9719fa3
...
@@ -79,6 +79,31 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
...
@@ -79,6 +79,31 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
end
end
end
end
describe
'pipeline protect'
do
subject
{
step
.
perform!
}
context
'when ref is protected'
do
before
do
allow
(
project
).
to
receive
(
:protected_for?
).
with
(
'master'
).
and_return
(
true
)
allow
(
project
).
to
receive
(
:protected_for?
).
with
(
'refs/heads/master'
).
and_return
(
true
)
end
it
'does not protect the pipeline'
do
subject
expect
(
pipeline
.
protected
).
to
eq
(
true
)
end
end
context
'when ref is not protected'
do
it
'does not protect the pipeline'
do
subject
expect
(
pipeline
.
protected
).
to
eq
(
false
)
end
end
end
context
'when pipeline has validation errors'
do
context
'when pipeline has validation errors'
do
let
(
:pipeline
)
do
let
(
:pipeline
)
do
build
(
:ci_pipeline
,
project:
project
,
ref:
nil
)
build
(
:ci_pipeline
,
project:
project
,
ref:
nil
)
...
...
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