diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 09:55:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 09:55:51 +0000 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /danger | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) | |
download | gitlab-ce-e8d2c2579383897a1dd7f9debd359abe8ae8373d.tar.gz |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'danger')
-rw-r--r-- | danger/database/Dangerfile | 12 | ||||
-rw-r--r-- | danger/datateam/Dangerfile | 18 | ||||
-rw-r--r-- | danger/feature_flag/Dangerfile | 41 | ||||
-rw-r--r-- | danger/gitaly/Dangerfile | 22 | ||||
-rw-r--r-- | danger/pajamas/Dangerfile | 1 | ||||
-rw-r--r-- | danger/specialization_labels/Dangerfile | 3 | ||||
-rw-r--r-- | danger/vue_shared_documentation/Dangerfile | 22 |
7 files changed, 85 insertions, 34 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index cd56ea8dd22..3018196ddbc 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -25,6 +25,11 @@ DB_FILES_MESSAGE = <<~MSG The following files require a review from the Database team: MSG +DB_REMOVE_MESSAGE = <<~MSG +If you no longer require a database review, you can remove this suggestion +by removing the ~database label and re-running the [`danger-review` job](#{ENV['CI_JOB_URL']}). +MSG + DATABASE_APPROVED_LABEL = 'database::approved' non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty? @@ -53,7 +58,12 @@ if gitlab.mr_labels.include?('database') || db_paths_to_review.any? 'review from the [Database team](https://gitlab.com/groups/gl-database/-/group_members).' markdown(DB_MESSAGE) - markdown(DB_FILES_MESSAGE + helper.markdown_list(db_paths_to_review)) if db_paths_to_review.any? + + if db_paths_to_review.any? + markdown(DB_FILES_MESSAGE + helper.markdown_list(db_paths_to_review)) + else + markdown(DB_REMOVE_MESSAGE) + end unless helper.has_database_scoped_labels? gitlab.api.update_merge_request(gitlab.mr_json['project_id'], diff --git a/danger/datateam/Dangerfile b/danger/datateam/Dangerfile index 0a33cb6777b..263fd4aa8e3 100644 --- a/danger/datateam/Dangerfile +++ b/danger/datateam/Dangerfile @@ -1,15 +1,19 @@ # frozen_string_literal: true -# rubocop:disable Style/SignalException + +DATA_WAREHOUSE_LABELS = [ + "Data Warehouse::Impact Check", + "Data Warehouse::Impacted", + "Data Warehouse::Not Impacted" +].freeze CHANGED_SCHEMA_MESSAGE = <<~MSG -Mentioning @gitlab-data/engineers to notify the team about changes to the db/structure.sql file. +Notification to the Data Team about changes to the db/structure.sql file, add label `Data Warehouse::Impact Check`. + +/label ~"Data Warehouse::Impact Check" MSG db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty? +no_data_warehouse_labels = (gitlab.mr_labels & DATA_WAREHOUSE_LABELS).empty? -if db_schema_updated - - markdown(CHANGED_SCHEMA_MESSAGE) - -end +markdown(CHANGED_SCHEMA_MESSAGE) if db_schema_updated && no_data_warehouse_labels diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile index bf2194724fc..9b67590f117 100644 --- a/danger/feature_flag/Dangerfile +++ b/danger/feature_flag/Dangerfile @@ -41,6 +41,19 @@ def message_for_feature_flag_missing_group!(feature_flag:, mr_group_label:) end end +def message_for_global_rollout(feature_flag) + return unless feature_flag.default_enabled == true + + message = <<~SUGGEST_COMMENT + You're about to [release the feature with the feature flag](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/issue_templates/Feature%20Flag%20Roll%20Out.md#optional-release-the-feature-with-the-feature-flag). + This process can only be done **after** the [global rollout on production](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/issue_templates/Feature%20Flag%20Roll%20Out.md#global-rollout-on-production). + Please make sure in [the rollout issue](#{feature_flag.rollout_issue_url}) that the preliminary steps have already been done. Otherwise, changing the YAML definition might not have the desired effect. + SUGGEST_COMMENT + + mr_line = feature_flag.raw.lines.find_index { |l| l.include?('default_enabled:') } + markdown(message, file: feature_flag.path, line: mr_line.succ) +end + def message_for_feature_flag_with_group!(feature_flag:, mr_group_label:) return if feature_flag.group_match_mr_label?(mr_group_label) @@ -65,30 +78,10 @@ feature_flag.feature_flag_files(change_type: :added).each do |feature_flag| check_feature_flag_yaml(feature_flag) 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." +feature_flag.feature_flag_files(change_type: :modified).each do |feature_flag| + message_for_global_rollout(feature_flag) 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 +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 diff --git a/danger/gitaly/Dangerfile b/danger/gitaly/Dangerfile new file mode 100644 index 00000000000..59e55845c83 --- /dev/null +++ b/danger/gitaly/Dangerfile @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +TEMPLATE_MESSAGE = <<~MSG +This merge request requires coordination with gitaly deployments. +Before merging this merge request we should verify that gitaly +running in production already implements the new gRPC interface +included here. + +Failing to do so will introduce a [non backward compatible +change](https://docs.gitlab.com/ee/development/multi_version_compatibility.html) +during canary depoyment that can cause an incident. + +1. Identify the gitaly MR introducing the new interface +1. Verify that the environment widget contains a `gprd` deployment +MSG + +changed_lines = helper.changed_lines('Gemfile.lock') +if changed_lines.any? { |line| line =~ /^\+\s+gitaly \(/ } + warn 'Changing gitaly gem can cause a multi-version incompatibility incident' + + markdown(TEMPLATE_MESSAGE) +end diff --git a/danger/pajamas/Dangerfile b/danger/pajamas/Dangerfile index 36bf7672cbf..dda0218e918 100644 --- a/danger/pajamas/Dangerfile +++ b/danger/pajamas/Dangerfile @@ -19,7 +19,6 @@ PATTERNS = %w[ <button <tabs bs-callout - createFlash deprecated-modal gl-deprecated-button gl-deprecated-dropdown diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile index 2261fe23e4e..35125f20b14 100644 --- a/danger/specialization_labels/Dangerfile +++ b/danger/specialization_labels/Dangerfile @@ -9,7 +9,8 @@ SPECIALIZATIONS = { docs: 'documentation', qa: 'QA', engineering_productivity: 'Engineering Productivity', - ci_template: 'ci::templates' + ci_template: 'ci::templates', + feature_flag: 'feature flag' }.freeze labels_to_add = project_helper.changes_by_category.each_with_object([]) do |(category, _changes), memo| diff --git a/danger/vue_shared_documentation/Dangerfile b/danger/vue_shared_documentation/Dangerfile new file mode 100644 index 00000000000..103ef3591af --- /dev/null +++ b/danger/vue_shared_documentation/Dangerfile @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +def has_matching_story?(file) + File.file?(file.dup.sub!(/\.vue$/, '.stories.js')) +end + +def get_vue_shared_files(files) + files.select do |file| + file.end_with?('.vue') && + file.include?('vue_shared/') && + !has_matching_story?(file) + end +end + +vue_shared_candidates = get_vue_shared_files(helper.all_changed_files) + +return if vue_shared_candidates.empty? + +documentation_url = 'https://docs.gitlab.com/ce/development/fe_guide/storybook' +file_list = "- #{vue_shared_candidates.map { |path| "`#{path}`" }.join("\n- ")}" + +warn "This merge request changed undocumented Vue components in `vue_shared/`. Please consider [creating Stories](#{documentation_url}) for these components:\n#{file_list}" |