From 1ca4f282a493af89c084038c67feca51f1ec5e23 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 28 Sep 2017 12:34:00 +0200 Subject: [PATCH 01/17] Add specs for methods that count pipeline seeds size --- spec/lib/gitlab/ci/stage/seed_spec.rb | 6 ++++++ spec/models/ci/pipeline_spec.rb | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/lib/gitlab/ci/stage/seed_spec.rb b/spec/lib/gitlab/ci/stage/seed_spec.rb index 9ecd128faca..3fe8d50c49a 100644 --- a/spec/lib/gitlab/ci/stage/seed_spec.rb +++ b/spec/lib/gitlab/ci/stage/seed_spec.rb @@ -11,6 +11,12 @@ describe Gitlab::Ci::Stage::Seed do described_class.new(pipeline, 'test', builds) end + describe '#size' do + it 'returns a number of jobs in the stage' do + expect(subject.size).to eq 2 + end + end + describe '#stage' do it 'returns hash attributes of a stage' do expect(subject.stage).to be_a Hash diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 9c1e460ab20..2c9e7013b77 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -238,7 +238,7 @@ describe Ci::Pipeline, :mailer do describe '#stage_seeds' do let(:pipeline) do - create(:ci_pipeline, config: { rspec: { script: 'rake' } }) + build(:ci_pipeline, config: { rspec: { script: 'rake' } }) end it 'returns preseeded stage seeds object' do @@ -247,6 +247,14 @@ describe Ci::Pipeline, :mailer do end end + describe '#seeds_size' do + let(:pipeline) { build(:ci_pipeline_with_one_job) } + + it 'returns number of jobs in stage seeds' do + expect(pipeline.seeds_size).to eq 1 + end + end + describe '#legacy_stages' do subject { pipeline.legacy_stages } From d3762c22473867d8543b0bb91fd0c696c7aa65f9 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 28 Sep 2017 12:28:26 +0200 Subject: [PATCH 02/17] Implement pipeline seeds size methods --- app/models/ci/pipeline.rb | 4 ++++ lib/gitlab/ci/stage/seed.rb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 3d5acc00f8f..323c2c4ce7c 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -312,6 +312,10 @@ module Ci @stage_seeds ||= config_processor.stage_seeds(self) end + def seeds_size + @seeds_size ||= stage_seeds.sum(&:size) + end + def has_kubernetes_active? project.kubernetes_service&.active? end diff --git a/lib/gitlab/ci/stage/seed.rb b/lib/gitlab/ci/stage/seed.rb index e19aae35a81..bc97aa63b02 100644 --- a/lib/gitlab/ci/stage/seed.rb +++ b/lib/gitlab/ci/stage/seed.rb @@ -3,7 +3,9 @@ module Gitlab module Stage class Seed attr_reader :pipeline + delegate :project, to: :pipeline + delegate :size, to: :@jobs def initialize(pipeline, stage, jobs) @pipeline = pipeline From f3ec51beba3f1af68d3238489566bb0bbce869a4 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 28 Sep 2017 12:57:16 +0200 Subject: [PATCH 03/17] Add a additional scope related to alive CI/CD statuses --- app/models/concerns/has_status.rb | 1 + spec/models/concerns/has_status_spec.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index 3803e18a96e..7c3ed96bc28 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -81,6 +81,7 @@ module HasStatus scope :canceled, -> { where(status: 'canceled') } scope :skipped, -> { where(status: 'skipped') } scope :manual, -> { where(status: 'manual') } + scope :alive, -> { where(status: [:created, :pending, :running]) } scope :created_or_pending, -> { where(status: [:created, :pending]) } scope :running_or_pending, -> { where(status: [:running, :pending]) } scope :finished, -> { where(status: [:success, :failed, :canceled]) } diff --git a/spec/models/concerns/has_status_spec.rb b/spec/models/concerns/has_status_spec.rb index a38f2553eb1..6866b43432c 100644 --- a/spec/models/concerns/has_status_spec.rb +++ b/spec/models/concerns/has_status_spec.rb @@ -231,6 +231,18 @@ describe HasStatus do end end + describe '.alive' do + subject { CommitStatus.alive } + + %i[running pending created].each do |status| + it_behaves_like 'containing the job', status + end + + %i[failed success].each do |status| + it_behaves_like 'not containing the job', status + end + end + describe '.created_or_pending' do subject { CommitStatus.created_or_pending } From 8912e99e5f65f148db97688b4d0c99126da222be Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 29 Sep 2017 10:05:11 +0200 Subject: [PATCH 04/17] Add failure_reason column to ci_pipelines Conflicts: db/schema.rb --- .../20170929080234_add_failure_reason_to_pipelines.rb | 9 +++++++++ db/schema.rb | 1 + 2 files changed, 10 insertions(+) create mode 100644 db/migrate/20170929080234_add_failure_reason_to_pipelines.rb diff --git a/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb b/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb new file mode 100644 index 00000000000..82adddbc1ec --- /dev/null +++ b/db/migrate/20170929080234_add_failure_reason_to_pipelines.rb @@ -0,0 +1,9 @@ +class AddFailureReasonToPipelines < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_pipelines, :failure_reason, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index fa1aad257db..5ebcf848709 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -342,6 +342,7 @@ ActiveRecord::Schema.define(version: 20171004121444) do t.integer "source" t.integer "config_source" t.boolean "protected" + t.integer "failure_reason" end add_index "ci_pipelines", ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree From 29f59bdf6f91fd2250fe237a320865e5c836f001 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 29 Sep 2017 10:18:53 +0200 Subject: [PATCH 05/17] Add failure reason enum to CI/CD pipeline model --- app/models/ci/pipeline.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 323c2c4ce7c..857db9622ee 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -58,6 +58,10 @@ module Ci auto_devops_source: 2 } + enum failure_reason: { + unknown_failure: 0 + } + state_machine :status, initial: :created do event :enqueue do transition created: :pending From 90fa4e7e54dc4f272b5f6a853f07b5e57a2a6cc4 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Fri, 29 Sep 2017 11:14:00 +0200 Subject: [PATCH 06/17] Move part of pipeline presenter to main CE file --- app/presenters/ci/pipeline_presenter.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index a542bdd8295..5e393e95c80 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -1,6 +1,13 @@ module Ci class PipelinePresenter < Gitlab::View::Presenter::Delegated - presents :pipeline + FAILURE_REASONS = {} + + def failure_reason + return unless pipeline.failure_reason? + + FAILURE_REASONS[pipeline.failure_reason.to_sym] || + pipeline.failure_reason + end def status_title if auto_canceled? From 41d8030ec2834da8acc8dc28d1ac57cdbbc0667e Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 2 Oct 2017 13:09:07 +0200 Subject: [PATCH 07/17] Pass pipeline failure reason to a transition event --- app/models/ci/pipeline.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 857db9622ee..ddf80433c57 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -113,6 +113,12 @@ module Ci pipeline.auto_canceled_by = nil end + before_transition any => :failed do |pipeline, transition| + transition.args.first.try do |reason| + pipeline.failure_reason = reason + end + end + after_transition [:created, :pending] => :running do |pipeline| pipeline.run_after_commit { PipelineMetricsWorker.perform_async(pipeline.id) } end From 9f639b073394b23c4e559b95dc5ba3ad422352bc Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 2 Oct 2017 13:40:12 +0200 Subject: [PATCH 08/17] Set a pipeline failure reason when it has YAML errors Conflicts: app/models/ci/pipeline.rb --- app/models/ci/pipeline.rb | 3 ++- lib/gitlab/ci/pipeline/chain/validate/config.rb | 2 +- spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index ddf80433c57..728ce1d9cc6 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -59,7 +59,8 @@ module Ci } enum failure_reason: { - unknown_failure: 0 + unknown_failure: 0, + config_error: 1 } state_machine :status, initial: :created do diff --git a/lib/gitlab/ci/pipeline/chain/validate/config.rb b/lib/gitlab/ci/pipeline/chain/validate/config.rb index 489bcd79655..075504bcce5 100644 --- a/lib/gitlab/ci/pipeline/chain/validate/config.rb +++ b/lib/gitlab/ci/pipeline/chain/validate/config.rb @@ -13,7 +13,7 @@ module Gitlab end if @command.save_incompleted && @pipeline.has_yaml_errors? - @pipeline.drop + @pipeline.drop!(:config_error) end return error(@pipeline.yaml_errors) diff --git a/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb index 3740df88f42..8357af38f92 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/validate/config_spec.rb @@ -55,6 +55,10 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::Config do it 'fails the pipeline' do expect(pipeline.reload).to be_failed end + + it 'sets a config error failure reason' do + expect(pipeline.reload.config_error?).to eq true + end end context 'when saving incomplete pipeline is not allowed' do From ffce9fd53f4e7d400d6f45e00b7e59acd902f3a6 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 3 Oct 2017 13:02:48 +0200 Subject: [PATCH 09/17] Expose failure reason in pipeline error badge Conflicts: app/serializers/pipeline_entity.rb --- .../javascripts/pipelines/components/pipeline_url.vue | 7 +++++++ app/serializers/pipeline_entity.rb | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/pipelines/components/pipeline_url.vue b/app/assets/javascripts/pipelines/components/pipeline_url.vue index 76b97af39f1..9da0aac50a1 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_url.vue +++ b/app/assets/javascripts/pipelines/components/pipeline_url.vue @@ -72,6 +72,13 @@ :title="pipeline.yaml_errors"> yaml invalid + + error + (pipeline, _) { pipeline.has_yaml_errors? } + + expose :failure_reason, if: -> (pipeline, _) { pipeline.failure_reason? } do |pipeline| + pipeline.present.failure_reason + end expose :retry_path, if: -> (*) { can_retry? } do |pipeline| retry_project_pipeline_path(pipeline.project, pipeline) @@ -53,8 +59,6 @@ class PipelineEntity < Grape::Entity cancel_project_pipeline_path(pipeline.project, pipeline) end - expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? } - private alias_method :pipeline, :object From 123da5fbe8f5dee13278b1ef9aff79ff9adcef90 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 3 Oct 2017 13:18:59 +0200 Subject: [PATCH 10/17] Improve specs for pipeline failure reason presenter Conflicts: app/presenters/ci/pipeline_presenter.rb --- app/presenters/ci/pipeline_presenter.rb | 6 +++++- spec/presenters/ci/pipeline_presenter_spec.rb | 17 +++++++++++++++++ spec/serializers/pipeline_entity_spec.rb | 13 +++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 5e393e95c80..099b4720fb6 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -1,6 +1,10 @@ module Ci class PipelinePresenter < Gitlab::View::Presenter::Delegated - FAILURE_REASONS = {} + FAILURE_REASONS = { + config_error: 'CI/CD YAML configuration error!' + }.freeze + + presents :pipeline def failure_reason return unless pipeline.failure_reason? diff --git a/spec/presenters/ci/pipeline_presenter_spec.rb b/spec/presenters/ci/pipeline_presenter_spec.rb index e4886a8f019..f7ceaf844be 100644 --- a/spec/presenters/ci/pipeline_presenter_spec.rb +++ b/spec/presenters/ci/pipeline_presenter_spec.rb @@ -51,4 +51,21 @@ describe Ci::PipelinePresenter do end end end + + context '#failure_reason' do + context 'when pipeline has failure reason' do + it 'represents a failure reason sentence' do + pipeline.failure_reason = :config_error + + expect(presenter.failure_reason) + .to eq 'CI/CD YAML configuration error!' + end + end + + context 'when pipeline does not have failure reason' do + it 'returns nil' do + expect(presenter.failure_reason).to be_nil + end + end + end end diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/pipeline_entity_spec.rb index f8df461bc81..248552d1858 100644 --- a/spec/serializers/pipeline_entity_spec.rb +++ b/spec/serializers/pipeline_entity_spec.rb @@ -108,5 +108,18 @@ describe PipelineEntity do expect(subject[:ref][:path]).to be_nil end end + + context 'when pipeline has a failure reason set' do + let(:pipeline) { create(:ci_empty_pipeline) } + + before do + pipeline.drop!(:config_error) + end + + it 'has a correct failure reason' do + expect(subject[:failure_reason]) + .to eq 'CI/CD YAML configuration error!' + end + end end end From 599fb7ef7f042594021ca0d26d938683fbe1206d Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 3 Oct 2017 13:24:56 +0200 Subject: [PATCH 11/17] Add feature specs for pipeline failure reason badge --- spec/factories/ci/pipelines.rb | 1 + spec/features/projects/pipelines/pipelines_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index e5ea6b41ea3..f994c2df821 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -47,6 +47,7 @@ FactoryGirl.define do trait :invalid do config(rspec: nil) + failure_reason :config_error end trait :blocked do diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index f7b40cb1820..92486d2bc57 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -162,6 +162,16 @@ describe 'Pipelines', :js do expect(page).to have_selector( %Q{span[data-original-title="#{pipeline.yaml_errors}"]}) end + + it 'contains badge that indicates failure reason' do + expect(page).to have_content 'error' + end + + it 'contains badge with tooltip which contains failure reason' do + expect(pipeline.failure_reason?).to eq true + expect(page).to have_selector( + %Q{span[data-original-title="#{pipeline.present.failure_reason}"]}) + end end context 'with manual actions' do From 663f3240a95b68e23a0d89291edd0401e7887cb7 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 3 Oct 2017 13:42:51 +0200 Subject: [PATCH 12/17] Make it possible to export pipeline failure reason --- spec/lib/gitlab/import_export/safe_model_attributes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 7268226112c..48938346577 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -224,6 +224,7 @@ Ci::Pipeline: - auto_canceled_by_id - pipeline_schedule_id - config_source +- failure_reason - protected Ci::Stage: - id From 08cc88f9cecb626ba3f877dd52dd3666add1b434 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 4 Oct 2017 09:32:22 +0200 Subject: [PATCH 13/17] Add js test for pipelines component with error badge --- .../javascripts/pipelines/pipeline_url_spec.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index 256fdbe743c..260eb802bd4 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -125,4 +125,22 @@ describe('Pipeline Url Component', () => { component.$el.querySelector('.js-pipeline-url-autodevops').textContent.trim(), ).toEqual('Auto DevOps'); }); + + it('should render error badge when pipeline has a failure reason set', () => { + const component = new PipelineUrlComponent({ + propsData: { + pipeline: { + id: 1, + path: 'foo', + flags: { + failure_reason: true, + }, + failure_reason: 'some reason' + }, + }, + }).$mount(); + + expect(component.$el.querySelector('.js-pipeline-url-failure').textContent).toContain('error'); + expect(component.$el.querySelector('.js-pipeline-url-failure').getAttribute('title').toContain('some reason'); + }); }); From d6e0738098dea1b243280f857ed05c68ad5a8397 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 4 Oct 2017 11:02:52 +0200 Subject: [PATCH 14/17] Fix syntax error in forntend pipeline specs --- spec/javascripts/pipelines/pipeline_url_spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index 260eb802bd4..c40842f80b4 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -135,12 +135,13 @@ describe('Pipeline Url Component', () => { flags: { failure_reason: true, }, - failure_reason: 'some reason' + failure_reason: 'some reason', }, + autoDevopsHelpPath: 'foo', }, }).$mount(); expect(component.$el.querySelector('.js-pipeline-url-failure').textContent).toContain('error'); - expect(component.$el.querySelector('.js-pipeline-url-failure').getAttribute('title').toContain('some reason'); + expect(component.$el.querySelector('.js-pipeline-url-failure').getAttribute('title')).toContain('some reason'); }); }); From a2e6afdd8c3886ab7b0ac608da6c2952667fe877 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 4 Oct 2017 13:32:54 +0200 Subject: [PATCH 15/17] Fix frotnend pipeline specs for pipeline error badge --- spec/javascripts/pipelines/pipeline_url_spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index c40842f80b4..cb8e4c32780 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -141,7 +141,8 @@ describe('Pipeline Url Component', () => { }, }).$mount(); + expect(component.$el.querySelector('.js-pipeline-url-failure').textContent).toContain('error'); - expect(component.$el.querySelector('.js-pipeline-url-failure').getAttribute('title')).toContain('some reason'); + expect(component.$el.querySelector('.js-pipeline-url-failure').getAttribute('data-original-title')).toContain('some reason'); }); }); From 7db9323de7091b75c3c19b871f3632ed870f9b35 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 4 Oct 2017 14:55:03 +0200 Subject: [PATCH 16/17] Remove a redundant empty line in js pipelines specs --- spec/javascripts/pipelines/pipeline_url_spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/javascripts/pipelines/pipeline_url_spec.js b/spec/javascripts/pipelines/pipeline_url_spec.js index cb8e4c32780..4a4f2259d23 100644 --- a/spec/javascripts/pipelines/pipeline_url_spec.js +++ b/spec/javascripts/pipelines/pipeline_url_spec.js @@ -141,7 +141,6 @@ describe('Pipeline Url Component', () => { }, }).$mount(); - expect(component.$el.querySelector('.js-pipeline-url-failure').textContent).toContain('error'); expect(component.$el.querySelector('.js-pipeline-url-failure').getAttribute('data-original-title')).toContain('some reason'); }); From 83059f130e9049939e3e8251b7ede5fa128073fd Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 3 Oct 2017 10:12:28 +0200 Subject: [PATCH 17/17] Improve pipeline optimistic locking implementation --- app/models/ci/pipeline.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 728ce1d9cc6..cf3ce3c9e54 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -5,6 +5,7 @@ module Ci include Importable include AfterCommitQueue include Presentable + include Gitlab::OptimisticLocking belongs_to :project belongs_to :user @@ -274,7 +275,7 @@ module Ci end def cancel_running - Gitlab::OptimisticLocking.retry_lock(cancelable_statuses) do |cancelable| + retry_optimistic_lock(cancelable_statuses) do |cancelable| cancelable.find_each do |job| yield(job) if block_given? job.cancel @@ -418,7 +419,7 @@ module Ci end def update_status - Gitlab::OptimisticLocking.retry_lock(self) do + retry_optimistic_lock(self) do case latest_builds_status when 'pending' then enqueue when 'running' then run