From 81373fe07e0afe94e4d63a37c51a80c10132aeac Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sat, 12 Jun 2021 00:10:00 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- danger/feature_flag/Dangerfile | 24 ++++++++++++++++++++++++ danger/specialization_labels/Dangerfile | 3 +-- 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'danger') diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile index ac9ea812ebb..bf2194724fc 100644 --- a/danger/feature_flag/Dangerfile +++ b/danger/feature_flag/Dangerfile @@ -68,3 +68,27 @@ 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? + new_mr_title = helper.mr_title.dup + new_mr_title << ' [RUN ALL RSPEC]' unless helper.run_all_rspec_mr? + new_mr_title << ' [RUN AS-IF-FOSS]' unless helper.run_as_if_foss_mr? + + changes = {} + changes[:add_labels] = FEATURE_FLAG_LABEL unless helper.mr_has_labels?(FEATURE_FLAG_LABEL) + + if new_mr_title != helper.mr_title + changes[:title] = new_mr_title + else + message "You're adding or removing a feature flag, your MR title needs to include `[RUN ALL RSPEC] [RUN AS-IF-FOSS]` (we may have updated it automatically for you and started a new MR pipeline) to ensure everything is covered." + end + + if changes.any? + gitlab.api.update_merge_request( + gitlab.mr_json['project_id'], + gitlab.mr_json['iid'], + **changes + ) + gitlab.api.post("/projects/#{gitlab.mr_json['project_id']}/merge_requests/#{gitlab.mr_json['iid']}/pipelines") + end +end diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile index 35125f20b14..2261fe23e4e 100644 --- a/danger/specialization_labels/Dangerfile +++ b/danger/specialization_labels/Dangerfile @@ -9,8 +9,7 @@ SPECIALIZATIONS = { docs: 'documentation', qa: 'QA', engineering_productivity: 'Engineering Productivity', - ci_template: 'ci::templates', - feature_flag: 'feature flag' + ci_template: 'ci::templates' }.freeze labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo| -- cgit v1.2.3