diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-03-31 20:51:28 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-04-12 00:32:54 +0300 |
commit | 5d69f5b46d475f34fb71dfb4e8b683e90897f1da (patch) | |
tree | 48f268cb483ecab1d8d7e042c60931596838b1a3 /app/models/ci/build.rb | |
parent | 986b4a54ee159de56a7ebe51327887b49474813b (diff) |
Use Ci::Commit as Pipeline
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r-- | app/models/ci/build.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 7d33838044b..15fc714b538 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -50,7 +50,6 @@ module Ci scope :unstarted, ->() { where(runner_id: nil) } scope :ignore_failures, ->() { where(allow_failure: false) } - scope :similar, ->(build) { where(ref: build.ref, tag: build.tag, trigger_request_id: build.trigger_request_id) } mount_uploader :artifacts_file, ArtifactUploader mount_uploader :artifacts_metadata, ArtifactUploader @@ -62,6 +61,8 @@ module Ci before_destroy { project } + after_create :execute_hooks + class << self def columns_without_lazy (column_names - LAZY_ATTRIBUTES).map do |column_name| @@ -126,12 +127,16 @@ module Ci end def retried? - !self.commit.latest_statuses_for_ref(self.ref).include?(self) + !self.commit.latest.include?(self) + end + + def retry + Ci::Build.retry(self) end def depends_on_builds # Get builds of the same type - latest_builds = self.commit.builds.similar(self).latest + latest_builds = self.commit.builds.latest # Return builds from previous stages latest_builds.where('stage_idx < ?', stage_idx) |