summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/build.rb38
-rw-r--r--app/models/commit.rb6
-rw-r--r--app/views/builds/_build.html.haml12
3 files changed, 33 insertions, 23 deletions
diff --git a/app/models/build.rb b/app/models/build.rb
index 725da75..7a01ecf 100644
--- a/app/models/build.rb
+++ b/app/models/build.rb
@@ -2,22 +2,23 @@
#
# Table name: builds
#
-# id :integer not null, primary key
-# project_id :integer
-# status :string(255)
-# finished_at :datetime
-# trace :text
-# created_at :datetime
-# updated_at :datetime
-# started_at :datetime
-# runner_id :integer
-# commit_id :integer
-# coverage :float
-# commands :text
-# options :text
-# job_id :integer
-# name :string(255)
-# deploy :boolean default(FALSE)
+# id :integer not null, primary key
+# project_id :integer
+# status :string(255)
+# finished_at :datetime
+# trace :text
+# created_at :datetime
+# updated_at :datetime
+# started_at :datetime
+# runner_id :integer
+# commit_id :integer
+# coverage :float
+# commands :text
+# job_id :integer
+# name :string(255)
+# deploy :boolean default(FALSE)
+# options :text
+# allow_failure :boolean default(FALSE), not null
#
class Build < ActiveRecord::Base
@@ -75,6 +76,7 @@ class Build < ActiveRecord::Base
new_build.commit_id = build.commit_id
new_build.project_id = build.project_id
new_build.name = build.name
+ new_build.allow_failure = build.allow_failure
new_build.save
new_build
end
@@ -153,6 +155,10 @@ class Build < ActiveRecord::Base
canceled? || success? || failed?
end
+ def ignored?
+ failed? && allow_failure?
+ end
+
def timeout
project.timeout
end
diff --git a/app/models/commit.rb b/app/models/commit.rb
index d9774d3..3680220 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -111,7 +111,8 @@ class Commit < ActiveRecord::Base
name: build_attrs[:name],
commands: build_attrs[:script],
tag_list: build_attrs[:tags],
- options: build_attrs[:options]
+ options: build_attrs[:options],
+ allow_failure: build_attrs[:allow_failure]
})
end
end
@@ -149,6 +150,7 @@ class Commit < ActiveRecord::Base
commands: build_attrs[:script],
tag_list: build_attrs[:tags],
options: build_attrs[:options],
+ allow_failure: build_attrs[:allow_failure],
deploy: true
})
end
@@ -186,7 +188,7 @@ class Commit < ActiveRecord::Base
def success?
builds_without_retry.all? do |build|
- build.success?
+ build.success? || build.ignored?
end
end
diff --git a/app/views/builds/_build.html.haml b/app/views/builds/_build.html.haml
index b71111b..f2a340d 100644
--- a/app/views/builds/_build.html.haml
+++ b/app/views/builds/_build.html.haml
@@ -17,11 +17,13 @@
#{build.short_sha}
%td
= build.name
- - if build.tags.any?
- - build.tag_list.each do |tag|
- %span.label.label-primary
- = tag
-
+ .pull-right
+ - if build.tags.any?
+ - build.tag_list.each do |tag|
+ %span.label.label-primary
+ = tag
+ - if build.allow_failure
+ %span.label.label-danger allowed to fail
%td.duration
- if build.duration