From c0c72451b322df82101d13a5f9543d78aa31c2c7 Mon Sep 17 00:00:00 2001 From: Mayra Cabrera <mcabrera@gitlab.com> Date: Tue, 25 Apr 2023 10:48:58 -0600 Subject: [PATCH] Adjust stable branch logic for package-and-test The package-and-test-ee configuration was modified to suceed even with test failures, this makes the failures less noticeable and requires adjusting in the tooling side. This commit: * Updates the name of the package-and-test to specifically search for 'package-and-test' * Makes a Danger warn message about the package-and-test to always be sent (it used to only be sent if the status was different than success) --- spec/tooling/danger/stable_branch_spec.rb | 15 +++++++++++++-- tooling/danger/stable_branch.rb | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/spec/tooling/danger/stable_branch_spec.rb b/spec/tooling/danger/stable_branch_spec.rb index fc644413a5a45..439a878a5e60e 100644 --- a/spec/tooling/danger/stable_branch_spec.rb +++ b/spec/tooling/danger/stable_branch_spec.rb @@ -241,13 +241,23 @@ context 'when not an applicable version' do let(:target_branch) { '14-9-stable-ee' } - it_behaves_like 'with a warning', described_class::VERSION_WARNING_MESSAGE + it 'warns about the package-and-test pipeline and the version' do + expect(stable_branch).to receive(:warn).with(described_class::WARN_PACKAGE_AND_TEST_MESSAGE) + expect(stable_branch).to receive(:warn).with(described_class::VERSION_WARNING_MESSAGE) + + subject + end end context 'when the version API request fails' do let(:response_success) { false } - it_behaves_like 'with a warning', described_class::FAILED_VERSION_REQUEST_MESSAGE + it 'warns about the package-and-test pipeline and the version request' do + expect(stable_branch).to receive(:warn).with(described_class::WARN_PACKAGE_AND_TEST_MESSAGE) + expect(stable_branch).to receive(:warn).with(described_class::FAILED_VERSION_REQUEST_MESSAGE) + + subject + end end context 'when more than one page of versions is needed' do @@ -293,6 +303,7 @@ it 'adds a warning' do expect(HTTParty).to receive(:get).and_return(version_response).at_least(10).times + expect(stable_branch).to receive(:warn).with(described_class::WARN_PACKAGE_AND_TEST_MESSAGE) expect(stable_branch).to receive(:warn).with(described_class::FAILED_VERSION_REQUEST_MESSAGE) subject diff --git a/tooling/danger/stable_branch.rb b/tooling/danger/stable_branch.rb index 9deb4838079e0..bba198d1310fb 100644 --- a/tooling/danger/stable_branch.rb +++ b/tooling/danger/stable_branch.rb @@ -74,7 +74,7 @@ def check! if status.nil? || FAILING_PACKAGE_AND_TEST_STATUSES.include?(status) # rubocop:disable Style/GuardClause fail NEEDS_PACKAGE_AND_TEST_MESSAGE else - warn WARN_PACKAGE_AND_TEST_MESSAGE unless status == 'success' + warn WARN_PACKAGE_AND_TEST_MESSAGE end end # rubocop:enable Style/SignalException @@ -110,7 +110,7 @@ def package_and_test_bridge(mr_head_pipeline_id) gitlab .api .pipeline_bridges(helper.mr_target_project_id, mr_head_pipeline_id) - &.find { |bridge| bridge['name'].include?('package-and-test') } + &.find { |bridge| bridge['name'].include?('package-and-test-ee') } end def stable_target_branch -- GitLab