diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-05-09 13:14:45 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-05-09 20:09:41 +0200 |
commit | f09dcbd9bd2590bb66ee49b65637525a3c71a307 (patch) | |
tree | 8cdcbb6667697c559b59c4548c0857da364b8128 /app | |
parent | f2a4420d66216e3a9172f4ab45c6b4fa96578117 (diff) | |
download | gitlab-ce-f09dcbd9bd2590bb66ee49b65637525a3c71a307.tar.gz |
Make retried to be nullable
Diffstat (limited to 'app')
-rw-r--r-- | app/models/commit_status.rb | 2 | ||||
-rw-r--r-- | app/models/concerns/has_status.rb | 2 | ||||
-rw-r--r-- | app/services/ci/retry_build_service.rb | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 528bf4d87ac..7855c16ee5b 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -31,7 +31,7 @@ class CommitStatus < ActiveRecord::Base false, all_state_names - [:failed, :canceled, :manual]) end - scope :latest, -> { where(retried: false) } + scope :latest, -> { where(retried: [false, nil]) } scope :retried, -> { where(retried: true) } scope :ordered, -> { order(:name) } scope :latest_ordered, -> { latest.ordered.includes(project: :namespace) } diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index dff7b6e3523..3e4f8e6bff8 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -22,7 +22,7 @@ module HasStatus skipped = scope.skipped.select('count(*)').to_sql canceled = scope.canceled.select('count(*)').to_sql - "(CASE + "(CASE WHEN (#{builds})=(#{skipped}) THEN 'skipped' WHEN (#{builds})=(#{success}) THEN 'success' WHEN (#{builds})=(#{created}) THEN 'created' diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index 9c532b585a1..f51e9fd1d54 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -30,8 +30,8 @@ module Ci Ci::Build.transaction do # mark all other builds of that name as retried - build.pipeline.builds.where(name: build.name) - .where.not(retried: true) + build.pipeline.builds.latest + .where(name: build.name) .update_all(retried: true) project.builds.create!(Hash[attributes]) |