diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/build.rb | 38 | ||||
-rw-r--r-- | app/models/commit.rb | 6 |
2 files changed, 26 insertions, 18 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 |