summaryrefslogtreecommitdiff
path: root/tooling
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /tooling
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
downloadgitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'tooling')
-rw-r--r--tooling/config/CODEOWNERS.yml91
-rw-r--r--tooling/danger/datateam.rb15
-rw-r--r--tooling/danger/project_helper.rb8
-rw-r--r--tooling/lib/tooling/find_codeowners.rb32
-rw-r--r--tooling/overcommit/Gemfile.lock2
-rw-r--r--tooling/quality/test_level.rb9
6 files changed, 97 insertions, 60 deletions
diff --git a/tooling/config/CODEOWNERS.yml b/tooling/config/CODEOWNERS.yml
index d867c8c22fc..4fa7338b32d 100644
--- a/tooling/config/CODEOWNERS.yml
+++ b/tooling/config/CODEOWNERS.yml
@@ -6,53 +6,52 @@
'@gitlab-org/manage/authentication-and-authorization':
allow:
keywords:
- - password
- - auth
- - token
+ - 'password'
+ - 'auth'
+ - 'token'
patterns:
- - '/{,ee/}app/**/*%{keyword}*{/**/*,}'
- - '/{,ee/}config/**/*%{keyword}*{/**/*,}'
- - '/{,ee/}lib/**/*%{keyword}*{/**/*,}'
+ - '/{,ee/}app/**/*%{keyword}*{,/**/*}'
+ - '/{,ee/}config/**/*%{keyword}*{,/**/*}'
+ - '/{,ee/}lib/**/*%{keyword}*{,/**/*}'
deny:
keywords:
- - author.
- - author_
- - authored
- - authoring
- - .png
- - .svg
- - deploy_token
- - runner{,s}_token
- - job_token
- - autocomplete_tokens
- - dast_site_token
- - reset_prometheus_token
- - reset_registration_token
- - runners_registration_token
- - terraform_registry_token
- - tokenizer
- - filtered_search
- - /alert_management/
- - /analytics/
- - /bitbucket/
- - /clusters/
- - /clusters_list/
- - /dast/
- - /dast_profiles/
- - /dast_site_tokens/
- - /dast_site_validation/
- - /dependency_proxy/
- - /error_tracking/
- - /google_api/
- - /google_cloud/
- - /jira_connect/
- - /kubernetes/
- - /protected_environments/
- - /config/feature_flags/development/jira_connect_
- - /config/metrics/
- - /app/controllers/groups/dependency_proxy_auth_controller.rb
- - /app/finders/ci/auth_job_finder.rb
- - /ee/config/metrics/
- - /lib/gitlab/conan_token.rb
+ - '*author.*'
+ - '*author_*'
+ - '*authored*'
+ - '*authoring*'
+ - '*.png'
+ - '*.svg'
+ - '*deploy_token{,s}{*,/**/*}'
+ - '*runner{,s}_token*'
+ - '*job_token{,_scope}{*,/**/*}'
+ - '*autocomplete_tokens*'
+ - 'dast_site_token*'
+ - 'reset_prometheus_token*'
+ - 'reset_registration_token*'
+ - 'runners_registration_token{*,/**/*}'
+ - 'terraform_registry_token*'
+ - 'filtered_search{_bar,}/'
+ - 'alert_management/'
+ - 'analytics/'
+ - 'bitbucket/'
+ - 'clusters/'
+ - 'clusters_list/'
+ - 'dast/'
+ - 'dast_profiles/'
+ - 'dast_site_tokens/'
+ - 'dast_site_validation/'
+ - 'dependency_proxy/'
+ - 'error_tracking/'
+ - 'google_api/'
+ - 'google_cloud/'
+ - 'jira_connect/'
+ - 'kubernetes/'
+ - 'protected_environments/'
+ - '/config/feature_flags/development/jira_connect_*'
+ - '/config/metrics/'
+ - '/app/controllers/groups/dependency_proxy_auth_controller.rb'
+ - '/app/finders/ci/auth_job_finder.rb'
+ - '/ee/config/metrics/'
+ - '/lib/gitlab/conan_token.rb'
patterns:
- - '**/*%{keyword}*{/**/*,}'
+ - '%{keyword}'
diff --git a/tooling/danger/datateam.rb b/tooling/danger/datateam.rb
index b3779aa13bb..dfa8e1549ef 100644
--- a/tooling/danger/datateam.rb
+++ b/tooling/danger/datateam.rb
@@ -15,6 +15,7 @@ module Tooling
DATA_WAREHOUSE_SCOPE = 'Data Warehouse::'
FILE_PATH_REGEX = %r{((ee|jh)/)?config/metrics(/.+\.yml)}.freeze
PERFORMANCE_INDICATOR_REGEX = %r{gmau|smau|paid_gmau|umau}.freeze
+ METRIC_REMOVED = %r{\+status: removed}.freeze
DATABASE_REGEX = %r{\Adb/structure\.sql}.freeze
STRUCTURE_SQL_FILE = %w(db/structure.sql).freeze
@@ -31,18 +32,18 @@ module Tooling
private
def data_warehouse_impact_files
- @impacted_files ||= (performance_indicator_changed_files + database_changed_files)
+ @impacted_files ||= (metrics_changed_files + database_changed_files)
end
def labelled_as_datawarehouse?
helper.mr_labels.any? { |label| label.start_with?(DATA_WAREHOUSE_SCOPE) }
end
- def performance_indicator_changed_files
+ def metrics_changed_files
metrics_definitions_files = helper.modified_files.grep(FILE_PATH_REGEX)
metrics_definitions_files.select do |file|
- helper.changed_lines(file).any? { |change| change =~ PERFORMANCE_INDICATOR_REGEX }
+ helper.changed_lines(file).any? { |change| performance_indicator_changed?(change) || status_removed?(change) }
end.compact
end
@@ -53,6 +54,14 @@ module Tooling
def database_changed_files
helper.modified_files & STRUCTURE_SQL_FILE
end
+
+ def performance_indicator_changed?(change)
+ change =~ PERFORMANCE_INDICATOR_REGEX
+ end
+
+ def status_removed?(change)
+ change =~ METRIC_REMOVED
+ end
end
end
end
diff --git a/tooling/danger/project_helper.rb b/tooling/danger/project_helper.rb
index c0afd9b7319..dbe3e6edd98 100644
--- a/tooling/danger/project_helper.rb
+++ b/tooling/danger/project_helper.rb
@@ -101,9 +101,13 @@ module Tooling
%r{\A\.editorconfig\z} => :tooling,
%r{Dangerfile\z} => :tooling,
%r{\A((ee|jh)/)?(danger/|tooling/danger/)} => :tooling,
- %r{\A((ee|jh)/)?(lib/)?scripts/.*\.rb} => [:backend, :tooling],
- %r{\A((ee|jh)/)?(lib/)?scripts/.*\.js} => [:frontend, :tooling],
+
+ %r{\A((ee|jh)/)?scripts/(lib/)?glfm/.*\.rb} => [:backend],
+ %r{\A((ee|jh)/)?scripts/(lib/)?glfm/.*\.js} => [:frontend],
+ %r{\A((ee|jh)/)?scripts/.*\.rb} => [:backend, :tooling],
+ %r{\A((ee|jh)/)?scripts/.*\.js} => [:frontend, :tooling],
%r{\A((ee|jh)/)?scripts/} => :tooling,
+
%r{\Atooling/} => :tooling,
%r{(CODEOWNERS)} => :tooling,
%r{(tests.yml)} => :tooling,
diff --git a/tooling/lib/tooling/find_codeowners.rb b/tooling/lib/tooling/find_codeowners.rb
index 35d8a9d7461..3b50b33d85c 100644
--- a/tooling/lib/tooling/find_codeowners.rb
+++ b/tooling/lib/tooling/find_codeowners.rb
@@ -31,8 +31,14 @@ module Tooling
consolidated_again = consolidate_paths(consolidated)
end
- consolidated.each do |file|
- puts "/#{file.chomp} #{group}"
+ consolidated.each do |line|
+ path = line.chomp
+
+ if File.directory?(path)
+ puts "/#{path}/ #{group}"
+ else
+ puts "/#{path} #{group}"
+ end
end
end
end
@@ -76,7 +82,27 @@ module Tooling
flags |= ::File::FNM_EXTGLOB
# END extension
- ::File.fnmatch?(pattern, path, flags)
+ ::File.fnmatch?(normalize_pattern(pattern), path, flags)
+ end
+
+ # Copied from ee/lib/gitlab/code_owners/file.rb
+ def normalize_pattern(pattern)
+ # Remove `\` when escaping `\#`
+ pattern = pattern.sub(/\A\\#/, '#')
+ # Replace all whitespace preceded by a \ with a regular whitespace
+ pattern = pattern.gsub(/\\\s+/, ' ')
+
+ return '/**/*' if pattern == '*'
+
+ unless pattern.start_with?('/')
+ pattern = "/**/#{pattern}"
+ end
+
+ if pattern.end_with?('/')
+ pattern = "#{pattern}**/*"
+ end
+
+ pattern
end
def consolidate_paths(matched_files)
diff --git a/tooling/overcommit/Gemfile.lock b/tooling/overcommit/Gemfile.lock
index 13c611439b6..a4b6f62a979 100644
--- a/tooling/overcommit/Gemfile.lock
+++ b/tooling/overcommit/Gemfile.lock
@@ -34,7 +34,7 @@ GEM
parallel (1.19.2)
parser (2.7.2.0)
ast (~> 2.4.1)
- rack (2.2.3)
+ rack (2.2.3.1)
rainbow (3.0.0)
regexp_parser (1.8.2)
rexml (3.2.4)
diff --git a/tooling/quality/test_level.rb b/tooling/quality/test_level.rb
index 6e58241bccb..82da0121e31 100644
--- a/tooling/quality/test_level.rb
+++ b/tooling/quality/test_level.rb
@@ -32,7 +32,6 @@ module Quality
haml_lint
helpers
initializers
- javascripts
lib
metrics_server
models
@@ -55,7 +54,7 @@ module Quality
views
workers
tooling
- component
+ components
],
integration: %w[
commands
@@ -75,7 +74,7 @@ module Quality
end
def pattern(level)
- @patterns[level] ||= "#{prefixes_for_pattern}spec/#{folders_pattern(level)}{,/**/}*#{suffix(level)}"
+ @patterns[level] ||= "#{prefixes_for_pattern}spec/#{folders_pattern(level)}{,/**/}*#{suffix(level)}".freeze # rubocop:disable Style/RedundantFreeze
end
def regexp(level)
@@ -149,11 +148,11 @@ module Quality
def folders_regex(level)
case level
when :migration
- "(#{migration_and_background_migration_folders.join('|')})"
+ "(#{migration_and_background_migration_folders.join('|')})/"
when :all
''
else
- "(#{TEST_LEVEL_FOLDERS.fetch(level).join('|')})"
+ "(#{TEST_LEVEL_FOLDERS.fetch(level).join('|')})/"
end
end
end