Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 23:02:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-03-18 23:02:30 +0300
commit41fe97390ceddf945f3d967b8fdb3de4c66b7dea (patch)
tree9c8d89a8624828992f06d892cd2f43818ff5dcc8 /tooling
parent0804d2dc31052fb45a1efecedc8e06ce9bc32862 (diff)
Add latest changes from gitlab-org/gitlab@14-9-stable-eev14.9.0-rc42
Diffstat (limited to 'tooling')
-rw-r--r--tooling/danger/changelog.rb232
-rw-r--r--tooling/danger/project_helper.rb16
-rw-r--r--tooling/docs/deprecation_handling.rb2
-rw-r--r--tooling/graphql/docs/helper.rb2
-rw-r--r--tooling/quality/test_level.rb1
5 files changed, 8 insertions, 245 deletions
diff --git a/tooling/danger/changelog.rb b/tooling/danger/changelog.rb
deleted file mode 100644
index 6a392afac13..00000000000
--- a/tooling/danger/changelog.rb
+++ /dev/null
@@ -1,232 +0,0 @@
-# frozen_string_literal: true
-
-require 'gitlab/dangerfiles/title_linting'
-
-module Tooling
- module Danger
- module Changelog
- NO_CHANGELOG_LABELS = [
- 'type::tooling',
- 'tooling::pipelines',
- 'tooling::workflow',
- 'ci-build',
- 'meta'
- ].freeze
- NO_CHANGELOG_CATEGORIES = %i[docs none].freeze
- CHANGELOG_TRAILER_REGEX = /^(?<name>Changelog):\s*(?<category>.+)$/i.freeze
- CHANGELOG_EE_TRAILER_REGEX = /^EE: true$/.freeze
- CHANGELOG_MODIFIED_URL_TEXT = "**CHANGELOG.md was edited.** Please remove the additions and follow the [changelog guidelines](https://docs.gitlab.com/ee/development/changelog.html).\n\n"
- CHANGELOG_MISSING_URL_TEXT = "**[CHANGELOG missing](https://docs.gitlab.com/ee/development/changelog.html)**:\n\n"
-
- OPTIONAL_CHANGELOG_MESSAGE = {
- local: "If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.",
- ci: <<~MSG
- If you want to create a changelog entry for GitLab FOSS, add the `Changelog` trailer to the commit message you want to add to the changelog.
-
- If you want to create a changelog entry for GitLab EE, also [add the `EE: true` trailer](https://docs.gitlab.com/ee/development/changelog.html#gitlab-enterprise-changes) to your commit message.
-
- If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.
- MSG
- }.freeze
- SEE_DOC = "See the [changelog documentation](https://docs.gitlab.com/ee/development/changelog.html)."
-
- REQUIRED_CHANGELOG_REASONS = {
- db_changes: 'introduces a database migration',
- feature_flag_removed: 'removes a feature flag'
- }.freeze
- REQUIRED_CHANGELOG_MESSAGE = {
- local: "This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry).",
- ci: <<~MSG
- To create a changelog entry, add the `Changelog` trailer to one of your Git commit messages.
-
- This merge request requires a changelog entry because it [%<reason>s](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry).
- MSG
- }.freeze
-
- CATEGORIES = YAML
- .load_file(File.expand_path('../../.gitlab/changelog_config.yml', __dir__))
- .fetch('categories')
- .keys
- .freeze
-
- class ChangelogCheckResult
- attr_reader :errors, :warnings, :markdowns, :messages
-
- def initialize(errors: [], warnings: [], markdowns: [], messages: [])
- @errors = errors
- @warnings = warnings
- @markdowns = markdowns
- @messages = messages
- end
- private_class_method :new
-
- def self.empty
- new
- end
-
- def self.error(error)
- new(errors: [error])
- end
-
- def self.warning(warning)
- new(warnings: [warning])
- end
-
- def error(error)
- errors << error
- end
-
- def warning(warning)
- warnings << warning
- end
-
- def markdown(markdown)
- markdowns << markdown
- end
-
- def message(message)
- messages << message
- end
- end
-
- # rubocop:disable Style/SignalException
- def check!
- if git.modified_files.include?("CHANGELOG.md")
- fail modified_text
- end
-
- if present?
- add_danger_messages(check_changelog_path)
- elsif required?
- required_texts.each { |_, text| fail(text) } # rubocop:disable Lint/UnreachableLoop
- elsif optional?
- message optional_text
- end
-
- check_changelog_commit_categories
- end
- # rubocop:enable Style/SignalException
-
- # rubocop:disable Style/SignalException
- def add_danger_messages(check_result)
- check_result.errors.each { |error| fail(error) } # rubocop:disable Lint/UnreachableLoop
- check_result.warnings.each { |warning| warn(warning) }
- check_result.markdowns.each { |markdown_hash| markdown(**markdown_hash) }
- check_result.messages.each { |text| message(text) }
- end
- # rubocop:enable Style/SignalException
-
- def check_changelog_commit_categories
- changelog_commits.each do |commit|
- add_danger_messages(check_changelog_trailer(commit))
- end
- end
-
- def check_changelog_trailer(commit)
- trailer = commit.message.match(CHANGELOG_TRAILER_REGEX)
- name = trailer[:name]
- category = trailer[:category]
-
- unless name == 'Changelog'
- return ChangelogCheckResult.error("The changelog trailer for commit #{commit.sha} must be `Changelog` (starting with a capital C), not `#{name}`")
- end
-
- return ChangelogCheckResult.empty if CATEGORIES.include?(category)
-
- ChangelogCheckResult.error("Commit #{commit.sha} uses an invalid changelog category: #{category}")
- end
-
- def check_changelog_path
- check_result = ChangelogCheckResult.empty
- return check_result unless present?
-
- ee_changes = project_helper.all_ee_changes.dup
-
- if ee_changes.any? && !ee_changelog? && !required?
- check_result.warning("This MR changes code in `ee/`, but its Changelog commit is missing the [`EE: true` trailer](https://docs.gitlab.com/ee/development/changelog.html#gitlab-enterprise-changes). Consider adding it to your Changelog commits.")
- end
-
- if ee_changes.empty? && ee_changelog?
- check_result.warning("This MR has a Changelog commit for EE, but no code changes in `ee/`. Consider removing the `EE: true` trailer from your commits.")
- end
-
- if ee_changes.any? && ee_changelog? && required_reasons.include?(:db_changes)
- check_result.warning("This MR has a Changelog commit with the `EE: true` trailer, but there are database changes which [requires](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry) the Changelog commit to not have the `EE: true` trailer. Consider removing the `EE: true` trailer from your commits.")
- end
-
- check_result
- end
-
- def required_reasons
- [].tap do |reasons|
- reasons << :db_changes if helper.changes.added.has_category?(:migration)
- reasons << :feature_flag_removed if helper.changes.deleted.has_category?(:feature_flag)
- end
- end
-
- def required?
- required_reasons.any?
- end
-
- def optional?
- categories_need_changelog? && mr_without_no_changelog_label?
- end
-
- def present?
- valid_changelog_commits.any?
- end
-
- def changelog_commits
- git.commits.select do |commit|
- commit.message.match?(CHANGELOG_TRAILER_REGEX)
- end
- end
-
- def valid_changelog_commits
- changelog_commits.select do |commit|
- trailer = commit.message.match(CHANGELOG_TRAILER_REGEX)
-
- CATEGORIES.include?(trailer[:category])
- end
- end
-
- def ee_changelog?
- changelog_commits.any? do |commit|
- commit.message.match?(CHANGELOG_EE_TRAILER_REGEX)
- end
- end
-
- def modified_text
- CHANGELOG_MODIFIED_URL_TEXT +
- (helper.ci? ? format(OPTIONAL_CHANGELOG_MESSAGE[:ci]) : OPTIONAL_CHANGELOG_MESSAGE[:local])
- end
-
- def required_texts
- required_reasons.each_with_object({}) do |required_reason, memo|
- memo[required_reason] =
- CHANGELOG_MISSING_URL_TEXT +
- (helper.ci? ? format(REQUIRED_CHANGELOG_MESSAGE[:ci], reason: REQUIRED_CHANGELOG_REASONS.fetch(required_reason)) : REQUIRED_CHANGELOG_MESSAGE[:local])
- end
- end
-
- def optional_text
- CHANGELOG_MISSING_URL_TEXT +
- (helper.ci? ? format(OPTIONAL_CHANGELOG_MESSAGE[:ci]) : OPTIONAL_CHANGELOG_MESSAGE[:local])
- end
-
- private
-
- def read_file(path)
- File.read(path)
- end
-
- def categories_need_changelog?
- (helper.changes.categories - NO_CHANGELOG_CATEGORIES).any?
- end
-
- def mr_without_no_changelog_label?
- (helper.mr_labels & NO_CHANGELOG_LABELS).empty?
- end
- end
- end
-end
diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb
index eaf33608b83..02002e1d1b2 100644
--- a/tooling/danger/project_helper.rb
+++ b/tooling/danger/project_helper.rb
@@ -4,7 +4,6 @@ module Tooling
module Danger
module ProjectHelper
LOCAL_RULES ||= %w[
- changelog
ci_config
database
documentation
@@ -54,7 +53,7 @@ module Tooling
%r{\A(
((ee|jh)/)?app/((?!.*clusters)(?!.*alert_management)(?!.*views)(?!.*assets).+/)?integration.+ |
((ee|jh)/)?app/((?!.*search).+/)?project_service.+ |
- ((ee|jh)/)?app/(models|helpers|workers|services|controllers)/(.+/)?(jira_connect.+|.*hook.+) |
+ ((ee|jh)/)?app/(models|helpers|workers|services|serializers|controllers)/(.+/)?(jira_connect.+|.*hook.+) |
((ee|jh)/)?app/controllers/(.+/)?oauth/jira/.+ |
((ee|jh)/)?app/services/(.+/)?jira.+ |
((ee|jh)/)?app/workers/(.+/)?(propagate_integration.+|irker_worker\.rb) |
@@ -75,7 +74,9 @@ module Tooling
spec/frontend/tracking/.*\.js |
spec/frontend/tracking_spec\.js
)\z}x => [:frontend, :product_intelligence],
- %r{\A((ee|jh)/)?app/(assets|views)/} => :frontend,
+ %r{\A((ee|jh)/)?app/assets/} => :frontend,
+ %r{\A((ee|jh)/)?app/views/.*\.svg} => :frontend,
+ %r{\A((ee|jh)/)?app/views/} => [:frontend, :backend],
%r{\A((ee|jh)/)?public/} => :frontend,
%r{\A((ee|jh)/)?spec/(javascripts|frontend|frontend_integration)/} => :frontend,
%r{\A((ee|jh)/)?vendor/assets/} => :frontend,
@@ -133,6 +134,7 @@ module Tooling
%r{\A((ee|jh)/)?lib/gitlab/usage_data_counters/.*\.yml\z} => [:product_intelligence],
%r{\A((ee|jh)/)?config/(events|metrics)/((.*\.yml)|(schema\.json))\z} => [:product_intelligence],
%r{\A((ee|jh)/)?lib/gitlab/usage_data(_counters)?(/|\.rb)} => [:backend, :product_intelligence],
+ %r{\A((ee|jh)/)?(spec/)?lib/gitlab/usage(/|\.rb)} => [:backend, :product_intelligence],
%r{\A(
lib/gitlab/tracking\.rb |
spec/lib/gitlab/tracking_spec\.rb |
@@ -193,18 +195,10 @@ module Tooling
helper.ci? ? LOCAL_RULES | CI_ONLY_RULES : LOCAL_RULES
end
- def all_ee_changes
- helper.changes.files.grep(%r{\Aee/})
- end
-
def file_lines(filename)
read_file(filename).lines(chomp: true)
end
- def labels_to_add
- @labels_to_add ||= []
- end
-
private
def read_file(filename)
diff --git a/tooling/docs/deprecation_handling.rb b/tooling/docs/deprecation_handling.rb
index 7dfd3e1101d..a620eac4c91 100644
--- a/tooling/docs/deprecation_handling.rb
+++ b/tooling/docs/deprecation_handling.rb
@@ -25,7 +25,7 @@ module Docs
entries = entries.sort_by { |d| d["name"] }
milestones = entries.map { |entry| entry[milestone_key_name] }.uniq
- milestones = VersionSorter.sort(milestones)
+ milestones = VersionSorter.rsort(milestones)
load_template(template_path)
.result_with_hash(entries: entries, milestones: milestones)
diff --git a/tooling/graphql/docs/helper.rb b/tooling/graphql/docs/helper.rb
index ca153c806c4..e4f14129f3b 100644
--- a/tooling/graphql/docs/helper.rb
+++ b/tooling/graphql/docs/helper.rb
@@ -57,7 +57,7 @@ module Tooling
---
stage: Ecosystem
group: Integrations
- info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
+ info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
<!---
diff --git a/tooling/quality/test_level.rb b/tooling/quality/test_level.rb
index 624564ecd05..fd86708bb7d 100644
--- a/tooling/quality/test_level.rb
+++ b/tooling/quality/test_level.rb
@@ -55,6 +55,7 @@ module Quality
views
workers
tooling
+ component
],
integration: %w[
commands