summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-06-27 14:53:21 +0000
committerRémy Coutable <remy@rymai.me>2016-06-27 14:53:21 +0000
commit52be433c36ec03e6bbbb1fe03dbc5232a0e6bc07 (patch)
treef0c724862cf1cc83cd9c4d0e3a07b74eda2b78e0
parentf48f7760c26e681e3f8b011c7c4e2b6ccfc9c3f5 (diff)
parent0550f2a5e7d8a7ed65632190b8febe2a9e01d6a0 (diff)
downloadgitlab-ce-52be433c36ec03e6bbbb1fe03dbc5232a0e6bc07.tar.gz
Merge branch 'case-insensitive-ci-skip' into 'master'
Allow "ci skip" to be in any case ## What does this MR do? This MR makes the check for the [ci skip] tag in a commit message case insensitive and adds support for [skip ci]. ## Are there points in the code the reviewer needs to double check? No. ## Why was this MR needed? I couldn't understand why some of my commits were being built, even though they contained "[CI Skip]". ## What are the relevant issue numbers? N/A ## Screenshots (if relevant) N/A ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !4785
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--doc/ci/yaml/README.md4
-rw-r--r--spec/services/create_commit_builds_service_spec.rb48
4 files changed, 51 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4a8188ea060..7453630488b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@ v 8.10.0 (unreleased)
- Fix changing issue state columns in milestone view
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- Add API endpoint for a group issues !4520 (mahcsig)
+ - Allow [ci skip] to be in any case and allow [skip ci]. !4785 (simon_w)
v 8.9.1
- Refactor labels documentation. !3347
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 0c9a5e42eec..10324bf2257 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -163,7 +163,7 @@ module Ci
end
def skip_ci?
- git_commit_message =~ /(\[ci skip\])/ if git_commit_message
+ git_commit_message =~ /\[(ci skip|skip ci)\]/i if git_commit_message
end
def environments
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 1892acda29b..d2d1b04f893 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -1034,8 +1034,8 @@ You can find the link under `/ci/lint` of your gitlab instance.
## Skipping builds
-If your commit message contains `[ci skip]`, the commit will be created but the
-builds will be skipped.
+If your commit message contains `[ci skip]` or `[skip ci]`, using any
+capitalization, the commit will be created but the builds will be skipped.
## Examples
diff --git a/spec/services/create_commit_builds_service_spec.rb b/spec/services/create_commit_builds_service_spec.rb
index deab242f45a..309213bd44c 100644
--- a/spec/services/create_commit_builds_service_spec.rb
+++ b/spec/services/create_commit_builds_service_spec.rb
@@ -83,6 +83,9 @@ describe CreateCommitBuildsService, services: true do
context 'when commit contains a [ci skip] directive' do
let(:message) { "some message[ci skip]" }
+ let(:messageFlip) { "some message[skip ci]" }
+ let(:capMessage) { "some message[CI SKIP]" }
+ let(:capMessageFlip) { "some message[SKIP CI]" }
before do
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { message }
@@ -96,12 +99,55 @@ describe CreateCommitBuildsService, services: true do
after: '31das312',
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: messageFlip }]
+ pipeline = service.execute(project, user,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ 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 [CI SKIP] tag in commit message" do
+ commits = [{ message: capMessage }]
+ pipeline = service.execute(project, user,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ 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: capMessageFlip }]
+ pipeline = service.execute(project, user,
+ ref: 'refs/tags/0_1',
+ before: '00000000',
+ after: '31das312',
+ commits: commits
+ )
+
expect(pipeline).to be_persisted
expect(pipeline.builds.any?).to be false
expect(pipeline.status).to eq("skipped")
end
- it "does not skips builds creation if there is no [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
allow_any_instance_of(Ci::Pipeline).to receive(:git_commit_message) { "some message" }
commits = [{ message: "some message" }]