diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-06 00:48:27 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-08-06 00:55:34 +0200 |
commit | 9d5ebedce36dd52858f1136e6f6a752448bd5868 (patch) | |
tree | 152be62ada1745e94b1e9e685ef184913d6baaac | |
parent | 3890f722d2bdd8964bac776f92772cc447d2b44c (diff) | |
download | gitlab-ci-broken-yaml-errors.tar.gz |
Prefer `failed` commit status over `skipped` if no builds were createdbroken-yaml-errors
-rw-r--r-- | app/models/commit.rb | 12 | ||||
-rw-r--r-- | spec/services/create_commit_service_spec.rb | 13 |
2 files changed, 18 insertions, 7 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index ec65d19..68057b7 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -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' diff --git a/spec/services/create_commit_service_spec.rb b/spec/services/create_commit_service_spec.rb index 13f9663..34e00d5 100644 --- a/spec/services/create_commit_service_spec.rb +++ b/spec/services/create_commit_service_spec.rb @@ -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 |