Commit a02e3f02 authored by Mayra Cabrera's avatar Mayra Cabrera

Discourage feature flags on security MRs

Modifies feature flags danger file to discourage the usafe of feature
flags on security merge requests.

As part of https://gitlab.com/gitlab-com/gl-infra/delivery/-/issues/1739
parent ffe7f77f
...@@ -53,14 +53,22 @@ def message_for_feature_flag_with_group!(feature_flag:, mr_group_label:) ...@@ -53,14 +53,22 @@ def message_for_feature_flag_with_group!(feature_flag:, mr_group_label:)
end end
end end
def feature_flag_file_added?
feature_flag.feature_flag_files(change_type: :added).any?
end
def feature_flag_file_added_or_removed? def feature_flag_file_added_or_removed?
feature_flag.feature_flag_files(change_type: :added).any? || feature_flag.feature_flag_files(change_type: :deleted).any? feature_flag_file_added? || feature_flag.feature_flag_files(change_type: :deleted).any?
end end
feature_flag.feature_flag_files(change_type: :added).each do |feature_flag| feature_flag.feature_flag_files(change_type: :added).each do |feature_flag|
check_feature_flag_yaml(feature_flag) check_feature_flag_yaml(feature_flag)
end end
if helper.security_mr? && feature_flag_file_added?
fail "Feature flags are discouraged from security merge requests. Read the [security documentation](https://gitlab.com/gitlab-org/release/docs/-/blob/master/general/security/utilities/feature_flags.md) for details."
end
if feature_flag_file_added_or_removed? if feature_flag_file_added_or_removed?
new_mr_title = helper.mr_title.dup new_mr_title = helper.mr_title.dup
new_mr_title << ' [RUN ALL RSPEC]' unless helper.run_all_rspec_mr? new_mr_title << ' [RUN ALL RSPEC]' unless helper.run_all_rspec_mr?
......
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