Commit 2fc91c48 authored by Simon Welsh's avatar Simon Welsh

Allow "ci skip" to be in any case

parent f0ed8930
...@@ -11,6 +11,7 @@ v 8.10.0 (unreleased) ...@@ -11,6 +11,7 @@ v 8.10.0 (unreleased)
- Fix changing issue state columns in milestone view - Fix changing issue state columns in milestone view
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt) - Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- Add API endpoint for a group issues !4520 (mahcsig) - Add API endpoint for a group issues !4520 (mahcsig)
- Allow [ci skip] to be in any case. !4785 (simon_w)
v 8.9.1 v 8.9.1
- Fix merge requests project settings help link anchor - Fix merge requests project settings help link anchor
......
...@@ -163,7 +163,7 @@ module Ci ...@@ -163,7 +163,7 @@ module Ci
end end
def skip_ci? def skip_ci?
git_commit_message =~ /(\[ci skip\])/ if git_commit_message git_commit_message =~ /(\[ci skip\])/i if git_commit_message
end end
def environments def environments
......
...@@ -1034,8 +1034,8 @@ You can find the link under `/ci/lint` of your gitlab instance. ...@@ -1034,8 +1034,8 @@ You can find the link under `/ci/lint` of your gitlab instance.
## Skipping builds ## Skipping builds
If your commit message contains `[ci skip]`, the commit will be created but the If your commit message contains `[ci skip]`, using any capitalization, the
builds will be skipped. commit will be created but the builds will be skipped.
## Examples ## Examples
......
...@@ -83,6 +83,7 @@ describe CreateCommitBuildsService, services: true do ...@@ -83,6 +83,7 @@ describe CreateCommitBuildsService, 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(:capMessage) { "some message[CI SKIP]" }
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 }
...@@ -101,6 +102,20 @@ describe CreateCommitBuildsService, services: true do ...@@ -101,6 +102,20 @@ describe CreateCommitBuildsService, services: true do
expect(pipeline.status).to eq("skipped") expect(pipeline.status).to eq("skipped")
end 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 "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] tag in commit message" 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) { "some message" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment