Skip to content
Snippets Groups Projects
Commit 062adc15 authored by Yury Lebedev's avatar Yury Lebedev
Browse files

[ci skip] tag for skipping builds

parent 23c543ae
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -63,7 +63,7 @@ class ProjectsController < ApplicationController
@build = @project.register_build(ref: params[:ref])
 
if @build and @build.id
Runner.perform_async(@build.id)
Runner.perform_async(@build.id) unless @build.ci_skip?
redirect_to project_build_path(@project, @build)
else
redirect_to project_path(@project), notice: 'Branch is not defined for this project'
Loading
Loading
Loading
Loading
@@ -55,6 +55,10 @@ class Build < ActiveRecord::Base
project.gitlab?
end
 
def ci_skip?
!!(commit.message =~ /(\[ci skip\])/)
end
def git_author_name
commit.author.name
rescue
Loading
Loading
Loading
Loading
@@ -15,6 +15,18 @@ describe Build do
it { should respond_to :git_author_name }
it { should respond_to :short_sha }
it { should respond_to :trace_html }
describe "#ci_skip?" do
let(:project) { FactoryGirl.create(:project) }
let(:build) { project.register_build(ref: 'master') }
it 'true if commit message contains [ci skip]' do
build.commit.stub(:message) { 'Small typo [ci skip]' }
build.ci_skip?.should == true
end
it 'false if commit message does not contain [ci skip]' do
build.ci_skip?.should == false
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