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
eb1956c5
Commit
eb1956c5
authored
Dec 07, 2018
by
Shinya Maeda
Committed by
Kamil Trzciński
Dec 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MR pipelines run on only: refex
parent
85f430cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
4 deletions
+66
-4
lib/gitlab/ci/build/policy/refs.rb
lib/gitlab/ci/build/policy/refs.rb
+8
-4
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+58
-0
No files found.
lib/gitlab/ci/build/policy/refs.rb
View file @
eb1956c5
...
@@ -32,6 +32,9 @@ module Gitlab
...
@@ -32,6 +32,9 @@ module Gitlab
return
true
if
pipeline
.
source
==
pattern
return
true
if
pipeline
.
source
==
pattern
return
true
if
pipeline
.
source
&
.
pluralize
==
pattern
return
true
if
pipeline
.
source
&
.
pluralize
==
pattern
# patterns can be matched only when branch or tag is used
# the pattern matching does not work for merge requests pipelines
if
pipeline
.
branch?
||
pipeline
.
tag?
if
pattern
.
first
==
"/"
&&
pattern
.
last
==
"/"
if
pattern
.
first
==
"/"
&&
pattern
.
last
==
"/"
Regexp
.
new
(
pattern
[
1
...-
1
])
=~
pipeline
.
ref
Regexp
.
new
(
pattern
[
1
...-
1
])
=~
pipeline
.
ref
else
else
...
@@ -42,4 +45,5 @@ module Gitlab
...
@@ -42,4 +45,5 @@ module Gitlab
end
end
end
end
end
end
end
end
end
spec/services/ci/create_pipeline_service_spec.rb
View file @
eb1956c5
...
@@ -810,6 +810,64 @@ describe Ci::CreatePipelineService do
...
@@ -810,6 +810,64 @@ describe Ci::CreatePipelineService do
end
end
end
end
end
end
context
"when config uses regular expression for only keyword"
do
let
(
:config
)
do
{
build:
{
stage:
'build'
,
script:
'echo'
,
only:
[
"/^
#{
ref_name
}
$/"
]
}
}
end
context
'when merge request is specified'
do
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project
,
source_branch:
ref_name
,
target_project:
project
,
target_branch:
'master'
)
end
it
'does not create a merge request pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
expect
(
pipeline
.
errors
[
:base
])
.
to
eq
([
'No stages / jobs for this pipeline.'
])
end
end
end
context
"when config has 'except: [tags]'"
do
let
(
:config
)
do
{
build:
{
stage:
'build'
,
script:
'echo'
,
except:
[
'tags'
]
}
}
end
context
'when merge request is specified'
do
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project
,
source_branch:
ref_name
,
target_project:
project
,
target_branch:
'master'
)
end
it
'does not create a merge request pipeline'
do
expect
(
pipeline
).
not_to
be_persisted
expect
(
pipeline
.
errors
[
:base
])
.
to
eq
([
'No stages / jobs for this pipeline.'
])
end
end
end
end
end
context
'when source is web'
do
context
'when source is web'
do
...
...
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