From 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 20 Sep 2021 13:18:24 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-3-stable-ee --- tooling/bin/find_changes | 21 ++++++++++++++ tooling/bin/find_tests | 16 ++--------- tooling/danger/product_intelligence.rb | 2 +- tooling/danger/project_helper.rb | 51 +++++++++++++++++----------------- tooling/deprecations/docs.rb | 37 ++++++++++++++++++++++++ tooling/graphql/docs/helper.rb | 4 +-- 6 files changed, 88 insertions(+), 43 deletions(-) create mode 100755 tooling/bin/find_changes create mode 100644 tooling/deprecations/docs.rb (limited to 'tooling') diff --git a/tooling/bin/find_changes b/tooling/bin/find_changes new file mode 100755 index 00000000000..466510ccb19 --- /dev/null +++ b/tooling/bin/find_changes @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'gitlab' + +gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '') +gitlab_endpoint = ENV.fetch('CI_API_V4_URL') +mr_project_path = ENV.fetch('CI_MERGE_REQUEST_PROJECT_PATH') +mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID') + +output_file = ARGV.shift + +Gitlab.configure do |config| + config.endpoint = gitlab_endpoint + config.private_token = gitlab_token +end + +mr_changes = Gitlab.merge_request_changes(mr_project_path, mr_iid) +file_changes = mr_changes.changes.map { |change| change['new_path'] } + +File.write(output_file, file_changes.join(' ')) diff --git a/tooling/bin/find_tests b/tooling/bin/find_tests index 97fadf406fe..33834064f36 100755 --- a/tooling/bin/find_tests +++ b/tooling/bin/find_tests @@ -1,24 +1,12 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require 'gitlab' require 'test_file_finder' -gitlab_token = ENV.fetch('DANGER_GITLAB_API_TOKEN', '') -gitlab_endpoint = ENV.fetch('CI_API_V4_URL') - -Gitlab.configure do |config| - config.endpoint = gitlab_endpoint - config.private_token = gitlab_token -end - +changes = ARGV.shift output_file = ARGV.shift -mr_project_path = ENV.fetch('CI_MERGE_REQUEST_PROJECT_PATH') -mr_iid = ENV.fetch('CI_MERGE_REQUEST_IID') - -mr_changes = Gitlab.merge_request_changes(mr_project_path, mr_iid) -changed_files = mr_changes.changes.map { |change| change['new_path'] } +changed_files = File.read(changes).split(' ') tff = TestFileFinder::FileFinder.new(paths: changed_files).tap do |file_finder| file_finder.use TestFileFinder::MappingStrategies::PatternMatching.load('tests.yml') diff --git a/tooling/danger/product_intelligence.rb b/tooling/danger/product_intelligence.rb index 9eab611ec68..30c961184f5 100644 --- a/tooling/danger/product_intelligence.rb +++ b/tooling/danger/product_intelligence.rb @@ -70,7 +70,7 @@ module Tooling 'data-track-action' ) all_changed_files.select do |file| - matching_files?(file, extension: '.rb', pattern: %r{Gitlab::Tracking\.(event|enabled\?|snowplow_options)$}) || + matching_files?(file, extension: '.rb', pattern: %r{Gitlab::Tracking\.(event|enabled\?|options)$}) || matching_files?(file, extension: '.js', pattern: js_patterns) || matching_files?(file, extension: '.vue', pattern: js_patterns) || matching_files?(file, extension: '.haml', pattern: %r{data: \{ track}) diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb index 07daf249023..109f77ed4d1 100644 --- a/tooling/danger/project_helper.rb +++ b/tooling/danger/project_helper.rb @@ -10,7 +10,6 @@ module Tooling duplicate_yarn_dependencies eslint gitaly - karma pajamas pipeline prettier @@ -37,7 +36,7 @@ module Tooling CATEGORIES = { [%r{usage_data\.rb}, %r{^(\+|-).*\s+(count|distinct_count|estimate_batch_distinct_count)\(.*\)(.*)$}] => [:database, :backend, :product_intelligence], - %r{\A(ee/)?config/feature_flags/} => :feature_flag, + %r{\A((ee|jh)/)?config/feature_flags/} => :feature_flag, %r{\Adoc/.*(\.(md|png|gif|jpg|yml))\z} => :docs, %r{\A(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(\.md)?\z} => :docs, @@ -48,11 +47,11 @@ module Tooling spec/frontend/tracking/.*\.js | spec/frontend/tracking_spec\.js )\z}x => [:frontend, :product_intelligence], - %r{\A(ee/)?app/(assets|views)/} => :frontend, - %r{\A(ee/)?public/} => :frontend, - %r{\A(ee/)?spec/(javascripts|frontend|frontend_integration)/} => :frontend, - %r{\A(ee/)?vendor/assets/} => :frontend, - %r{\A(ee/)?scripts/frontend/} => :frontend, + %r{\A((ee|jh)/)?app/(assets|views)/} => :frontend, + %r{\A((ee|jh)/)?public/} => :frontend, + %r{\A((ee|jh)/)?spec/(javascripts|frontend|frontend_integration)/} => :frontend, + %r{\A((ee|jh)/)?vendor/assets/} => :frontend, + %r{\A((ee|jh)/)?scripts/frontend/} => :frontend, %r{(\A|/)( \.babelrc | \.browserslistrc | @@ -75,12 +74,12 @@ module Tooling \.gitlab/ci/frontend\.gitlab-ci\.yml )\z}x => %i[frontend tooling], - %r{\A(ee/)?db/(geo/)?(migrate|post_migrate)/} => [:database, :migration], - %r{\A(ee/)?db/(?!fixtures)[^/]+} => [:database], - %r{\A(ee/)?lib/gitlab/(database|background_migration|sql|github_import)(/|\.rb)} => [:database, :backend], + %r{\A((ee|jh)/)?db/(geo/)?(migrate|post_migrate)/} => [:database, :migration], + %r{\A((ee|jh)/)?db/(?!fixtures)[^/]+} => [:database], + %r{\A((ee|jh)/)?lib/gitlab/(database|background_migration|sql|github_import)(/|\.rb)} => [:database, :backend], %r{\A(app/services/authorized_project_update/find_records_due_for_refresh_service)(/|\.rb)} => [:database, :backend], %r{\A(app/models/project_authorization|app/services/users/refresh_authorized_projects_service)(/|\.rb)} => [:database, :backend], - %r{\A(ee/)?app/finders/} => [:database, :backend], + %r{\A((ee|jh)/)?app/finders/} => [:database, :backend], %r{\Arubocop/cop/migration(/|\.rb)} => :database, %r{\A(\.gitlab-ci\.yml\z|\.gitlab\/ci)} => :tooling, @@ -88,22 +87,22 @@ module Tooling %r{\Alefthook.yml\z} => :tooling, %r{\A\.editorconfig\z} => :tooling, %r{Dangerfile\z} => :tooling, - %r{\A(ee/)?(danger/|tooling/danger/)} => :tooling, - %r{\A(ee/)?scripts/} => :tooling, + %r{\A((ee|jh)/)?(danger/|tooling/danger/)} => :tooling, + %r{\A((ee|jh)/)?scripts/} => :tooling, %r{\Atooling/} => :tooling, %r{(CODEOWNERS)} => :tooling, %r{(tests.yml)} => :tooling, %r{\Alib/gitlab/ci/templates} => :ci_template, - %r{\A(ee/)?spec/features/} => :test, - %r{\A(ee/)?spec/support/shared_examples/features/} => :test, - %r{\A(ee/)?spec/support/shared_contexts/features/} => :test, - %r{\A(ee/)?spec/support/helpers/features/} => :test, + %r{\A((ee|jh)/)?spec/features/} => :test, + %r{\A((ee|jh)/)?spec/support/shared_examples/features/} => :test, + %r{\A((ee|jh)/)?spec/support/shared_contexts/features/} => :test, + %r{\A((ee|jh)/)?spec/support/helpers/features/} => :test, - %r{\A(ee/)?lib/gitlab/usage_data_counters/.*\.yml\z} => [:product_intelligence], - %r{\A(ee/)?config/metrics/((.*\.yml)|(schema\.json))\z} => [:product_intelligence], - %r{\A(ee/)?lib/gitlab/usage_data(_counters)?(/|\.rb)} => [:backend, :product_intelligence], + %r{\A((ee|jh)/)?lib/gitlab/usage_data_counters/.*\.yml\z} => [:product_intelligence], + %r{\A((ee|jh)/)?config/metrics/((.*\.yml)|(schema\.json))\z} => [:product_intelligence], + %r{\A((ee|jh)/)?lib/gitlab/usage_data(_counters)?(/|\.rb)} => [:backend, :product_intelligence], %r{\A( lib/gitlab/tracking\.rb | spec/lib/gitlab/tracking_spec\.rb | @@ -112,21 +111,21 @@ module Tooling lib/generators/rails/usage_metric_definition_generator\.rb | spec/lib/generators/usage_metric_definition_generator_spec\.rb | generator_templates/usage_metric_definition/metric_definition\.yml)\z}x => [:backend, :product_intelligence], - %r{\A(ee/)?app/(?!assets|views)[^/]+} => :backend, - %r{\A(ee/)?(bin|config|generator_templates|lib|rubocop)/} => :backend, - %r{\A(ee/)?spec/} => :backend, - %r{\A(ee/)?vendor/} => :backend, + %r{\A((ee|jh)/)?app/(?!assets|views)[^/]+} => :backend, + %r{\A((ee|jh)/)?(bin|config|generator_templates|lib|rubocop)/} => :backend, + %r{\A((ee|jh)/)?spec/} => :backend, + %r{\A((ee|jh)/)?vendor/} => :backend, %r{\A(Gemfile|Gemfile.lock|Rakefile)\z} => :backend, %r{\A[A-Z_]+_VERSION\z} => :backend, %r{\A\.rubocop((_manual)?_todo)?\.yml\z} => :backend, %r{\Afile_hooks/} => :backend, - %r{\A(ee/)?qa/} => :qa, + %r{\A((ee|jh)/)?qa/} => :qa, %r{\Aworkhorse/.*} => :workhorse, # Files that don't fit into any category are marked with :none - %r{\A(ee/)?changelogs/} => :none, + %r{\A((ee|jh)/)?changelogs/} => :none, %r{\Alocale/gitlab\.pot\z} => :none, # GraphQL auto generated doc files and schema diff --git a/tooling/deprecations/docs.rb b/tooling/deprecations/docs.rb new file mode 100644 index 00000000000..adc3e0edb10 --- /dev/null +++ b/tooling/deprecations/docs.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true +require 'erb' + +module Deprecations + module Docs + module_function + + def path + Rails.root.join("doc/update/deprecations.md") + end + + def render + deprecations_yaml_glob = Rails.root.join("data/deprecations/**/*.yml") + + source_files = Rake::FileList.new(deprecations_yaml_glob) do |fl| + fl.exclude(/example\.yml$/) + end + + deprecations = source_files.flat_map do |file| + YAML.load_file(file) + end + + deprecations = VersionSorter.rsort(deprecations) { |d| d["removal_milestone"] } + + milestones = deprecations.map { |d| d["removal_milestone"] }.uniq + + template = Rails.root.join("data/deprecations/templates/_deprecation_template.md.erb") + + load_template(template) + .result_with_hash(deprecations: deprecations, milestones: milestones) + end + + def load_template(filename) + ERB.new(File.read(filename), trim_mode: '-') + end + end +end diff --git a/tooling/graphql/docs/helper.rb b/tooling/graphql/docs/helper.rb index 4a41930df46..ca153c806c4 100644 --- a/tooling/graphql/docs/helper.rb +++ b/tooling/graphql/docs/helper.rb @@ -55,8 +55,8 @@ module Tooling def auto_generated_comment <<-MD.strip_heredoc --- - stage: Plan - group: Project Management + 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 --- -- cgit v1.2.3