summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-23 00:05:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-23 00:05:40 +0000
commit20c396b4c9f52858b386e06d0b64c9f40a0559a2 (patch)
tree63e464df8a6f09577a2e9824c8068cf377d2d0e8
parent22f43167474102e26b4b585df6dbb541e48b7879 (diff)
downloadgitlab-ce-20c396b4c9f52858b386e06d0b64c9f40a0559a2.tar.gz
Add latest changes from gitlab-org/gitlab@15-8-stable-ee
-rw-r--r--spec/tooling/danger/stable_branch_spec.rb16
-rw-r--r--tooling/danger/stable_branch.rb8
2 files changed, 14 insertions, 10 deletions
diff --git a/spec/tooling/danger/stable_branch_spec.rb b/spec/tooling/danger/stable_branch_spec.rb
index 08fd25b30e0..677e190b584 100644
--- a/spec/tooling/danger/stable_branch_spec.rb
+++ b/spec/tooling/danger/stable_branch_spec.rb
@@ -34,6 +34,14 @@ RSpec.describe Tooling::Danger::StableBranch, feature_category: :delivery do
end
end
+ shared_examples 'with a warning' do |failure_message|
+ it 'fails' do
+ expect(stable_branch).to receive(:warn).with(failure_message)
+
+ subject
+ end
+ end
+
context 'when not applicable' do
where(:stable_branch?, :security_mr?) do
true | true
@@ -103,17 +111,13 @@ RSpec.describe Tooling::Danger::StableBranch, feature_category: :delivery do
context 'when not an applicable version' do
let(:target_branch) { '14-9-stable-ee' }
- it_behaves_like 'with a failure', described_class::VERSION_ERROR_MESSAGE
+ it_behaves_like 'with a warning', described_class::VERSION_WARNING_MESSAGE
end
context 'when the version API request fails' do
let(:response_success) { false }
- it 'adds a warning' do
- expect(stable_branch).to receive(:warn).with(described_class::FAILED_VERSION_REQUEST_MESSAGE)
-
- subject
- end
+ it_behaves_like 'with a warning', described_class::FAILED_VERSION_REQUEST_MESSAGE
end
context 'when more than one page of versions is needed' do
diff --git a/tooling/danger/stable_branch.rb b/tooling/danger/stable_branch.rb
index 6c0b94b4f06..83e8b0a7a9d 100644
--- a/tooling/danger/stable_branch.rb
+++ b/tooling/danger/stable_branch.rb
@@ -32,8 +32,8 @@ module Tooling
This branch is meant for backporting bug fixes. If this MR qualifies please add the `type::bug` label. #{MAINTENANCE_POLICY_MESSAGE}
MSG
- VERSION_ERROR_MESSAGE = <<~MSG
- Patches are only being accepted on the most recent 3 minor versions of GitLab. #{MAINTENANCE_POLICY_MESSAGE}
+ VERSION_WARNING_MESSAGE = <<~MSG
+ Backporting to older releases requires an [exception request process](https://docs.gitlab.com/ee/policy/maintenance.html#backporting-to-older-releases)
MSG
FAILED_VERSION_REQUEST_MESSAGE = <<~MSG
@@ -46,7 +46,8 @@ module Tooling
fail FEATURE_ERROR_MESSAGE if has_feature_label?
fail BUG_ERROR_MESSAGE unless has_bug_label?
- fail VERSION_ERROR_MESSAGE unless targeting_patchable_version?
+
+ warn VERSION_WARNING_MESSAGE unless targeting_patchable_version?
end
# rubocop:enable Style/SignalException
@@ -69,7 +70,6 @@ module Tooling
last_three_minor_versions.include?(targeted_version)
rescue VersionApiError
- # don't fail the job since we do not know the recent versions
warn FAILED_VERSION_REQUEST_MESSAGE
true
end