summaryrefslogtreecommitdiff
path: root/lib/tasks/gitlab/tw
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /lib/tasks/gitlab/tw
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
downloadgitlab-ce-0c872e02b2c822e3397515ec324051ff540f0cd5.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'lib/tasks/gitlab/tw')
-rw-r--r--lib/tasks/gitlab/tw/codeowners.rake21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/tasks/gitlab/tw/codeowners.rake b/lib/tasks/gitlab/tw/codeowners.rake
index 7a2dee3e2e4..ec2ea623e02 100644
--- a/lib/tasks/gitlab/tw/codeowners.rake
+++ b/lib/tasks/gitlab/tw/codeowners.rake
@@ -81,6 +81,10 @@ namespace :tw do
CodeOwnerRule.new('Workspace', '@lciutacu')
].freeze
+ ERRORS_EXCLUDED_FILES = [
+ '/doc/architecture'
+ ].freeze
+
CODEOWNERS_BLOCK_BEGIN = "# Begin rake-managed-docs-block"
CODEOWNERS_BLOCK_END = "# End rake-managed-docs-block"
@@ -105,16 +109,17 @@ namespace :tw do
Dir.glob(path) do |file|
yaml_data = YAML.load_file(file)
document = Document.new(yaml_data['group'], yaml_data['redirect_to'])
+ relative_file = file.delete_prefix(Dir.pwd)
if document.missing_metadata?
- errors << file
+ errors << relative_file unless ERRORS_EXCLUDED_FILES.any? { |element| relative_file.starts_with?(element) }
next
end
writer = writer_for_group(document.group)
next unless writer
- mappings << DocumentOwnerMapping.new(file.delete_prefix(Dir.pwd), writer) if document.has_a_valid_group?
+ mappings << DocumentOwnerMapping.new(relative_file, writer) if document.has_a_valid_group?
end
deduplicated_mappings = Set.new
@@ -139,10 +144,16 @@ namespace :tw do
File.write(codeowners_path, new_codeowners_content)
+ if current_codeowners_content == new_codeowners_content
+ puts "~ CODEOWNERS already up to date".color(:yellow)
+ else
+ puts "✓ CODEOWNERS updated".color(:green)
+ end
+
if errors.present?
- puts "-----"
- puts "ERRORS - the following files are missing the correct metadata:"
- errors.map { |file| puts file.gsub(Dir.pwd, ".") }
+ puts ""
+ puts "✘ Files with missing metadata found:".color(:red)
+ errors.map { |file| puts file }
end
end
end