Skip to content
Snippets Groups Projects
Commit 9d5ebedc authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Prefer `failed` commit status over `skipped` if no builds were created

parent 3890f722
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -161,15 +161,13 @@ class Commit < ActiveRecord::Base
end
 
def status
if skip_ci? || builds.none?
if skip_ci?
return 'skipped'
end
if yaml_errors.present?
elsif yaml_errors.present?
return 'failed'
end
if success?
elsif builds.none?
return 'skipped'
elsif success?
'success'
elsif pending?
'pending'
Loading
Loading
Loading
Loading
@@ -76,6 +76,19 @@ describe CreateCommitService do
commit.builds.first.name.should == "staging"
end
it "skips builds creation if there is [ci skip] tag in commit message and yaml is invalid" do
commits = [{message: "some message[ci skip]"}]
commit = service.execute(project,
ref: 'refs/tags/0_1',
before: '00000000',
after: '31das312',
commits: commits,
ci_yaml_file: "invalid: file"
)
commit.builds.any?.should be_false
commit.status.should == "skipped"
end
end
 
it "skips build creation if there are already builds" do
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