Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-03-31 20:51:28 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-04-12 00:32:54 +0300
commit5d69f5b46d475f34fb71dfb4e8b683e90897f1da (patch)
tree48f268cb483ecab1d8d7e042c60931596838b1a3 /app/models/ci/build.rb
parent986b4a54ee159de56a7ebe51327887b49474813b (diff)
Use Ci::Commit as Pipeline
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb11
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)