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
Boxiang Sun
gitlab-ce
Commits
ad88cf3e
Commit
ad88cf3e
authored
Feb 10, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated ci skip regex to accept underscores and hyphens
parent
7bf28a4a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
43 deletions
+31
-43
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+2
-1
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+29
-42
No files found.
app/services/ci/create_pipeline_service.rb
View file @
ad88cf3e
...
@@ -59,7 +59,8 @@ module Ci
...
@@ -59,7 +59,8 @@ module Ci
private
private
def
skip_ci?
def
skip_ci?
pipeline
.
git_commit_message
=~
/\[(ci skip|skip ci)\]/i
if
pipeline
.
git_commit_message
return
false
unless
pipeline
.
git_commit_message
pipeline
.
git_commit_message
=~
/\[(ci[ _-]skip|skip[ _-]ci)\]/i
end
end
def
commit
def
commit
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
ad88cf3e
...
@@ -79,16 +79,25 @@ describe Ci::CreatePipelineService, services: true do
...
@@ -79,16 +79,25 @@ describe Ci::CreatePipelineService, services: true do
context
'when commit contains a [ci skip] directive'
do
context
'when commit contains a [ci skip] directive'
do
let
(
:message
)
{
"some message[ci skip]"
}
let
(
:message
)
{
"some message[ci skip]"
}
let
(
:messageFlip
)
{
"some message[skip ci]"
}
let
(
:capMessage
)
{
"some message[CI SKIP]"
}
ci_messages
=
[
let
(
:capMessageFlip
)
{
"some message[SKIP CI]"
}
"some message[ci skip]"
,
"some message[skip ci]"
,
"some message[CI SKIP]"
,
"some message[SKIP CI]"
,
"some message[ci_skip]"
,
"some message[skip_ci]"
,
"some message[ci-skip]"
,
"some message[skip-ci]"
]
before
do
before
do
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:git_commit_message
)
{
message
}
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:git_commit_message
)
{
message
}
end
end
it
"skips builds creation if there is [ci skip] tag in commit message"
do
ci_messages
.
each
do
|
ci_message
|
commits
=
[{
message:
message
}]
it
"skips builds creation if the commit message is
#{
ci_message
}
"
do
commits
=
[{
message:
ci_message
}]
pipeline
=
execute
(
ref:
'refs/heads/master'
,
pipeline
=
execute
(
ref:
'refs/heads/master'
,
before:
'00000000'
,
before:
'00000000'
,
after:
project
.
commit
.
id
,
after:
project
.
commit
.
id
,
...
@@ -98,47 +107,25 @@ describe Ci::CreatePipelineService, services: true do
...
@@ -98,47 +107,25 @@ describe Ci::CreatePipelineService, services: true do
expect
(
pipeline
.
builds
.
any?
).
to
be
false
expect
(
pipeline
.
builds
.
any?
).
to
be
false
expect
(
pipeline
.
status
).
to
eq
(
"skipped"
)
expect
(
pipeline
.
status
).
to
eq
(
"skipped"
)
end
end
it
"skips builds creation if there is [skip ci] tag in commit message"
do
commits
=
[{
message:
messageFlip
}]
pipeline
=
execute
(
ref:
'refs/heads/master'
,
before:
'00000000'
,
after:
project
.
commit
.
id
,
commits:
commits
)
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
.
builds
.
any?
).
to
be
false
expect
(
pipeline
.
status
).
to
eq
(
"skipped"
)
end
end
it
"skips builds creation if there is [CI SKIP] tag in commit message"
do
it
"does not skips builds creation if there is no [ci skip] or [skip ci] tag in commit message"
do
commits
=
[{
message:
capMessage
}]
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:git_commit_message
)
{
"some message"
}
pipeline
=
execute
(
ref:
'refs/heads/master'
,
before:
'00000000'
,
after:
project
.
commit
.
id
,
commits:
commits
)
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
.
builds
.
any?
).
to
be
false
expect
(
pipeline
.
status
).
to
eq
(
"skipped"
)
end
it
"skips builds creation if there is [SKIP CI] tag in commit message"
do
commits
=
[{
message:
"some message"
}]
commits
=
[{
message:
capMessageFlip
}]
pipeline
=
execute
(
ref:
'refs/heads/master'
,
pipeline
=
execute
(
ref:
'refs/heads/master'
,
before:
'00000000'
,
before:
'00000000'
,
after:
project
.
commit
.
id
,
after:
project
.
commit
.
id
,
commits:
commits
)
commits:
commits
)
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
).
to
be_persisted
expect
(
pipeline
.
builds
.
any?
).
to
be
false
expect
(
pipeline
.
builds
.
first
.
name
).
to
eq
(
"rspec"
)
expect
(
pipeline
.
status
).
to
eq
(
"skipped"
)
end
end
it
"does not skip
s builds creation if there is no [ci skip] or [skip ci] tag in commit message
"
do
it
"does not skip
builds creation if the commit message is nil
"
do
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:git_commit_message
)
{
"some message"
}
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:git_commit_message
)
{
nil
}
commits
=
[{
message:
"some message"
}]
commits
=
[{
message:
nil
}]
pipeline
=
execute
(
ref:
'refs/heads/master'
,
pipeline
=
execute
(
ref:
'refs/heads/master'
,
before:
'00000000'
,
before:
'00000000'
,
after:
project
.
commit
.
id
,
after:
project
.
commit
.
id
,
...
...
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