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
path: root/gems
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2024-01-22 12:08:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-22 12:08:28 +0300
commit56865fdf95db03cc0ccd01a88d9457ba0a050153 (patch)
treecfa861e4b33f65c4fff2486b04abfe1127ee80f4 /gems
parent65d7736ff13e1f5c393f6723b7da0d1b2ddb94f5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'gems')
-rw-r--r--gems/gitlab-housekeeper/Gemfile.lock2
-rw-r--r--gems/gitlab-housekeeper/gitlab-housekeeper.gemspec1
-rw-r--r--gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb5
-rw-r--r--gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb33
-rw-r--r--gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb5
-rw-r--r--gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb16
6 files changed, 35 insertions, 27 deletions
diff --git a/gems/gitlab-housekeeper/Gemfile.lock b/gems/gitlab-housekeeper/Gemfile.lock
index 9fbdc246811..292bfdd6eeb 100644
--- a/gems/gitlab-housekeeper/Gemfile.lock
+++ b/gems/gitlab-housekeeper/Gemfile.lock
@@ -11,6 +11,7 @@ PATH
specs:
gitlab-housekeeper (0.1.0)
activesupport
+ awesome_print
httparty
rubocop
@@ -30,6 +31,7 @@ GEM
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
+ awesome_print (1.9.2)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crack (0.4.3)
diff --git a/gems/gitlab-housekeeper/gitlab-housekeeper.gemspec b/gems/gitlab-housekeeper/gitlab-housekeeper.gemspec
index 4083b3c2d11..ca78d3136b7 100644
--- a/gems/gitlab-housekeeper/gitlab-housekeeper.gemspec
+++ b/gems/gitlab-housekeeper/gitlab-housekeeper.gemspec
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'activesupport'
spec.add_runtime_dependency 'httparty'
spec.add_runtime_dependency 'rubocop'
+ spec.add_runtime_dependency 'awesome_print'
spec.add_development_dependency 'gitlab-styles'
spec.add_development_dependency 'rspec-rails'
diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb
index 94bddbaf95f..329d32885ee 100644
--- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb
+++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/git.rb
@@ -49,11 +49,6 @@ module Gitlab
#{change.title}
#{change.description}
-
- This commit was generated by
- [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139492).
-
- Changelog: other
MSG
Shell.execute("git", "commit", "-m", commit_message)
diff --git a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb
index 1be94e15f37..cebe2acfe5b 100644
--- a/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb
+++ b/gems/gitlab-housekeeper/lib/gitlab/housekeeper/runner.rb
@@ -4,6 +4,7 @@ require 'active_support/core_ext/string'
require 'gitlab/housekeeper/keep'
require 'gitlab/housekeeper/gitlab_client'
require 'gitlab/housekeeper/git'
+require 'awesome_print'
require 'digest'
module Gitlab
@@ -32,6 +33,7 @@ module Gitlab
keep = keep_class.new
keep.each_change do |change|
branch_name = git.commit_in_branch(change)
+ add_standard_change_data(change)
if @dry_run
dry_run(change, branch_name)
@@ -49,6 +51,19 @@ module Gitlab
puts "Housekeeper created #{created} MRs"
end
+ def add_standard_change_data(change)
+ change.labels ||= []
+ change.labels << 'automation:gitlab-housekeeper-authored'
+
+ change.description += <<~MARKDOWN
+
+ This change was generated by
+ [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper)
+
+ Changelog: other
+ MARKDOWN
+ end
+
def git
@git ||= ::Gitlab::Housekeeper::Git.new(logger: @logger)
end
@@ -60,22 +75,22 @@ module Gitlab
end
def dry_run(change, branch_name)
- puts "=> #{change.identifiers.join(': ')}"
+ puts "=> #{change.identifiers.join(': ')}".purple
- if change.labels.present?
- puts '=> Attributes:'
- puts "Labels: #{change.labels.join(', ')}"
- puts
- end
-
- puts '=> Title:'
- puts change.title
+ puts '=> Title:'.purple
+ puts change.title.purple
puts
puts '=> Description:'
puts change.description
puts
+ if change.labels.present?
+ puts '=> Attributes:'
+ puts "Labels: #{change.labels.join(', ')}"
+ puts
+ end
+
puts '=> Diff:'
puts Shell.execute('git', '--no-pager', 'diff', '--color=always', 'master', branch_name, '--',
*change.changed_files)
diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb
index 8cf69d2b62c..485c46f7ad0 100644
--- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb
+++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/git_spec.rb
@@ -92,11 +92,6 @@ RSpec.describe ::Gitlab::Housekeeper::Git do
split over multiple lines!
- This commit was generated by
- [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139492).
-
- Changelog: other
-
diff --git a/files/test_file2.txt b/files/test_file2.txt
new file mode 100644
index 0000000..ff205e0
diff --git a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb
index d3267cb001f..51dcc3b763f 100644
--- a/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb
+++ b/gems/gitlab-housekeeper/spec/gitlab/housekeeper/runner_spec.rb
@@ -100,8 +100,8 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do
.with(
source_project_id: '123',
title: 'The title of MR1',
- description: 'The description of the MR',
- labels: ['example-label'],
+ description: /The description of the MR/,
+ labels: %w[example-label automation:gitlab-housekeeper-authored],
source_branch: 'the-identifier-for-the-first-change',
target_branch: 'master',
target_project_id: '456',
@@ -113,8 +113,8 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do
.with(
source_project_id: '123',
title: 'The title of MR2',
- description: 'The description of the MR',
- labels: ['example-label'],
+ description: /The description of the MR/,
+ labels: %w[example-label automation:gitlab-housekeeper-authored],
source_branch: 'the-identifier-for-the-second-change',
target_branch: 'master',
target_project_id: '456',
@@ -157,8 +157,8 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do
.with(
source_project_id: '123',
title: 'The title of MR1',
- description: 'The description of the MR',
- labels: ['example-label'],
+ description: /The description of the MR/,
+ labels: %w[example-label automation:gitlab-housekeeper-authored],
source_branch: 'the-identifier-for-the-first-change',
target_branch: 'master',
target_project_id: '456',
@@ -170,8 +170,8 @@ RSpec.describe ::Gitlab::Housekeeper::Runner do
.with(
source_project_id: '123',
title: 'The title of MR2',
- description: 'The description of the MR',
- labels: ['example-label'],
+ description: /The description of the MR/,
+ labels: %w[example-label automation:gitlab-housekeeper-authored],
source_branch: 'the-identifier-for-the-second-change',
target_branch: 'master',
target_project_id: '456',