Commit d47c7f31 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'sh-prevent-retry-of-retried-builds' into 'master'

Prevent retried builds from being retried again [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!62349
parents 1548cf81 f932aea5
......@@ -469,7 +469,13 @@ module Ci
end
def retryable?
!archived? && (success? || failed? || canceled?)
if Feature.enabled?(:prevent_retry_of_retried_jobs, project, default_enabled: :yaml)
return false if retried? || archived?
success? || failed? || canceled?
else
!archived? && (success? || failed? || canceled?)
end
end
def retries_count
......
---
name: prevent_retry_of_retried_jobs
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62349
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/331695
milestone: '14.0'
type: development
group: group::continuous integration
default_enabled: false
......@@ -1880,6 +1880,26 @@ RSpec.describe Ci::Build do
it { is_expected.not_to be_retryable }
end
context 'when a canceled build has been retried already' do
before do
project.add_developer(user)
build.cancel!
described_class.retry(build, user)
end
context 'when prevent_retry_of_retried_jobs feature flag is enabled' do
it { is_expected.not_to be_retryable }
end
context 'when prevent_retry_of_retried_jobs feature flag is disabled' do
before do
stub_feature_flags(prevent_retry_of_retried_jobs: false)
end
it { is_expected.to be_retryable }
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment