Skip to content
代码片段 群组 项目
提交 fb444b78 编辑于 作者: Steve Abrams's avatar Steve Abrams
浏览文件

Skip certain Danger rules for stable branch MRs

- Skip database warnings
- Skip product intelligence review
- Skip data team warnings
上级 a32933f3
No related branches found
No related tags found
无相关合并请求
...@@ -45,6 +45,8 @@ geo_migration_created = !git.added_files.grep(%r{\Aee/db/geo/(post_)?migrate/}). ...@@ -45,6 +45,8 @@ geo_migration_created = !git.added_files.grep(%r{\Aee/db/geo/(post_)?migrate/}).
format_str = helper.ci? ? SCHEMA_NOT_UPDATED_MESSAGE_FULL : SCHEMA_NOT_UPDATED_MESSAGE_SHORT format_str = helper.ci? ? SCHEMA_NOT_UPDATED_MESSAGE_FULL : SCHEMA_NOT_UPDATED_MESSAGE_SHORT
return if stable_branch.valid_stable_branch?
if non_geo_migration_created && !non_geo_db_schema_updated if non_geo_migration_created && !non_geo_db_schema_updated
warn format(format_str, migrations: 'migrations', schema: helper.html_link("db/structure.sql")) warn format(format_str, migrations: 'migrations', schema: helper.html_link("db/structure.sql"))
end end
......
# frozen_string_literal: true # frozen_string_literal: true
return if stable_branch.valid_stable_branch?
markdown(datateam.build_message) if datateam.impacted? markdown(datateam.build_message) if datateam.impacted?
# frozen_string_literal: true # frozen_string_literal: true
return if stable_branch.valid_stable_branch?
product_intelligence.check! product_intelligence.check!
product_intelligence.check_affected_scopes! product_intelligence.check_affected_scopes!
......
...@@ -104,6 +104,9 @@ categories << :product_intelligence if helper.mr_labels.include?("product intell ...@@ -104,6 +104,9 @@ categories << :product_intelligence if helper.mr_labels.include?("product intell
# Skip Product intelligence reviews for growth experiment MRs # Skip Product intelligence reviews for growth experiment MRs
categories.delete(:product_intelligence) if helper.mr_labels.include?("growth experiment") categories.delete(:product_intelligence) if helper.mr_labels.include?("growth experiment")
# Skip specialty reviews for stable branch MRs since they have already been merged to the default branch
categories.subtract([:database, :ux, :product_intelligence]) if stable_branch.valid_stable_branch?
if changes.any? if changes.any?
random_roulette_spins = roulette.spin(nil, categories, timezone_experiment: false) random_roulette_spins = roulette.spin(nil, categories, timezone_experiment: false)
......
...@@ -351,4 +351,26 @@ ...@@ -351,4 +351,26 @@
it { is_expected.to eq(result) } it { is_expected.to eq(result) }
end end
end end
describe '#valid_stable_branch?' do
it "returns false when on the default branch" do
allow(fake_helper).to receive(:mr_target_branch).and_return('main')
expect(stable_branch.valid_stable_branch?).to be(false)
end
it "returns true when on a stable branch" do
allow(fake_helper).to receive(:mr_target_branch).and_return('15-1-stable-ee')
allow(fake_helper).to receive(:security_mr?).and_return(false)
expect(stable_branch.valid_stable_branch?).to be(true)
end
it "returns false when on a stable branch on a security MR" do
allow(fake_helper).to receive(:mr_target_branch).and_return('15-1-stable-ee')
allow(fake_helper).to receive(:security_mr?).and_return(true)
expect(stable_branch.valid_stable_branch?).to be(false)
end
end
end end
...@@ -85,12 +85,12 @@ def encourage_package_and_qa_execution? ...@@ -85,12 +85,12 @@ def encourage_package_and_qa_execution?
!has_flaky_failure_label? !has_flaky_failure_label?
end end
private
def valid_stable_branch? def valid_stable_branch?
!!stable_target_branch && !helper.security_mr? !!stable_target_branch && !helper.security_mr?
end end
private
def package_and_test_bridge_and_pipeline_status def package_and_test_bridge_and_pipeline_status
mr_head_pipeline_id = gitlab.mr_json.dig('head_pipeline', 'id') mr_head_pipeline_id = gitlab.mr_json.dig('head_pipeline', 'id')
return unless mr_head_pipeline_id return unless mr_head_pipeline_id
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册