Skip to content
Snippets Groups Projects
Commit 48626249 authored by Kamil Trzcinski's avatar Kamil Trzcinski Committed by Robert Speicher
Browse files

Retrigger builds with [ci skip]

parent a913424a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -102,7 +102,7 @@ class Commit < ActiveRecord::Base
end
 
def create_builds_for_stage(stage, trigger_request)
return if skip_ci?
return if skip_ci? && trigger_request.blank?
return unless config_processor
 
builds_attrs = config_processor.builds_for_stage_and_ref(stage, ref, tag)
Loading
Loading
@@ -121,7 +121,7 @@ class Commit < ActiveRecord::Base
end
 
def create_next_builds(trigger_request)
return if skip_ci?
return if skip_ci? && trigger_request.blank?
return unless config_processor
 
stages = builds.where(trigger_request: trigger_request).group_by(&:stage)
Loading
Loading
@@ -132,7 +132,7 @@ class Commit < ActiveRecord::Base
end
 
def create_builds(trigger_request = nil)
return if skip_ci?
return if skip_ci? && trigger_request.blank?
return unless config_processor
 
config_processor.stages.any? do |stage|
Loading
Loading
@@ -244,6 +244,7 @@ class Commit < ActiveRecord::Base
end
 
def skip_ci?
return if builds.any?
commits = push_data[:commits]
commits.present? && commits.last[:message] =~ /(\[ci skip\])/
end
Loading
Loading
Loading
Loading
@@ -196,6 +196,21 @@ describe Commit do
commit.builds.reload
commit.builds.size.should == 4
end
context 'for [ci skip]' do
before do
commit.push_data[:commits][0][:message] = 'skip this commit [ci skip]'
commit.save
end
it 'rebuilds commit' do
commit.status.should == 'skipped'
commit.create_builds(trigger_request).should be_true
commit.builds.reload
commit.builds.size.should == 2
commit.status.should == 'pending'
end
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment