diff options
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/cleanup.rake | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/db.rake | 20 | ||||
-rw-r--r-- | lib/tasks/gitlab/generate_sample_prometheus_data.rake | 27 | ||||
-rw-r--r-- | lib/tasks/gitlab/info.rake | 16 | ||||
-rw-r--r-- | lib/tasks/gitlab/list_repos.rake | 3 | ||||
-rw-r--r-- | lib/tasks/gitlab/shell.rake | 4 | ||||
-rw-r--r-- | lib/tasks/gitlab/update_templates.rake | 6 | ||||
-rw-r--r-- | lib/tasks/tanuki_emoji.rake | 2 |
8 files changed, 37 insertions, 43 deletions
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake index c13da77217e..31695d3da79 100644 --- a/lib/tasks/cleanup.rake +++ b/lib/tasks/cleanup.rake @@ -10,7 +10,7 @@ namespace :gitlab do Gitlab.config.repositories.storages.each do |name, repository_storage| repo_root = repository_storage.legacy_disk_path.chomp('/') # Look for global repos (legacy, depth 1) and normal repos (depth 2) - IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *+moved*.git)) do |find| + IO.popen(%W[find #{repo_root} -mindepth 1 -maxdepth 2 -name *+moved*.git]) do |find| find.each_line do |path| path.chomp! diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 546f5621515..cf52a219e83 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -258,6 +258,18 @@ namespace :gitlab do end end + def disabled_db_flags_note + return unless Feature.enabled?(:disallow_database_ddl_feature_flags, type: :ops) + + puts <<~NOTE.color(:yellow) + Note: disallow_database_ddl_feature_flags feature is currently enabled. Disable it to proceed. + + Disable with: Feature.disable(:disallow_database_ddl_feature_flags) + NOTE + + yield if block_given? + end + desc 'Enqueue an index for reindexing' task :enqueue_reindexing_action, [:index_name, :database] => :environment do |_, args| model = Gitlab::Database.database_base_models[args.fetch(:database, Gitlab::Database::PRIMARY_DATABASE_NAME)] @@ -269,7 +281,9 @@ namespace :gitlab do puts "There are #{Gitlab::Database::Reindexing::QueuedAction.queued.size} queued actions in total." end - unless Feature.enabled?(:database_reindexing, type: :ops) + disabled_db_flags_note + + if Feature.disabled?(:database_reindexing, type: :ops) puts <<~NOTE.color(:yellow) Note: database_reindexing feature is currently disabled. @@ -283,6 +297,8 @@ namespace :gitlab do task database_name, [:pick] => :environment do |_, args| args.with_defaults(pick: 2) + disabled_db_flags_note { exit } + if Feature.disabled?(:database_async_index_operations, type: :ops) puts <<~NOTE.color(:yellow) Note: database async index operations feature is currently disabled. @@ -313,6 +329,8 @@ namespace :gitlab do task database_name, [:pick] => :environment do |_, args| args.with_defaults(pick: 2) + disabled_db_flags_note { exit } + if Feature.disabled?(:database_async_foreign_key_validation, type: :ops) puts <<~NOTE.color(:yellow) Note: database async foreign key validation feature is currently disabled. diff --git a/lib/tasks/gitlab/generate_sample_prometheus_data.rake b/lib/tasks/gitlab/generate_sample_prometheus_data.rake deleted file mode 100644 index 4cd75af9d00..00000000000 --- a/lib/tasks/gitlab/generate_sample_prometheus_data.rake +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -namespace :gitlab do - desc "GitLab | Generate Sample Prometheus Data" - task :generate_sample_prometheus_data, [:environment_id] => :gitlab_environment do |_, args| - environment = Environment.find(args[:environment_id]) - metrics = PrometheusMetric.where(project_id: [environment.project.id, nil]) - query_variables = Gitlab::Prometheus::QueryVariables.call(environment) - - sample_metrics_directory_name = Metrics::SampleMetricsService::DIRECTORY - FileUtils.mkdir_p(sample_metrics_directory_name) - - sample_metrics_intervals = [30.minutes, 180.minutes, 8.hours, 24.hours, 72.hours, 7.days] - - metrics.each do |metric| - query = metric.query % query_variables - - next unless metric.identifier - - result = sample_metrics_intervals.each_with_object({}) do |interval, memo| - memo[interval.to_i / 60] = environment.prometheus_adapter.prometheus_client.query_range(query, start: interval.ago) - end - - File.write("#{sample_metrics_directory_name}/#{metric.identifier}.yml", result.to_yaml) - end - end -end diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake index 26ffe2c3f7b..9752a6c0886 100644 --- a/lib/tasks/gitlab/info.rake +++ b/lib/tasks/gitlab/info.rake @@ -5,17 +5,17 @@ namespace :gitlab do desc 'GitLab | Env | Show information about GitLab and its environment' task info: :gitlab_environment do # check if there is an RVM environment - rvm_version = run_and_match(%w(rvm --version), /[\d\.]+/).try(:to_s) + rvm_version = run_and_match(%w[rvm --version], /[\d\.]+/).try(:to_s) # check Ruby version - ruby_version = run_and_match(%w(ruby --version), /[\d\.p]+/).try(:to_s) + ruby_version = run_and_match(%w[ruby --version], /[\d\.p]+/).try(:to_s) # check Gem version - gem_version = run_command(%w(gem --version)) + gem_version = run_command(%w[gem --version]) # check Bundler version - bunder_version = run_and_match(%w(bundle --version), /[\d\.]+/).try(:to_s) + bunder_version = run_and_match(%w[bundle --version], /[\d\.]+/).try(:to_s) # check Rake version - rake_version = run_and_match(%w(rake --version), /[\d\.]+/).try(:to_s) + rake_version = run_and_match(%w[rake --version], /[\d\.]+/).try(:to_s) # check redis version - redis_version = run_and_match(%w(redis-cli --version), /redis-cli (\d+\.\d+\.\d+)/).to_a + redis_version = run_and_match(%w[redis-cli --version], /redis-cli (\d+\.\d+\.\d+)/).to_a # check for system defined proxies if Gitlab.ee? @@ -23,7 +23,7 @@ namespace :gitlab do end # check Go version - go_version = run_and_match(%w(go version), /go version (.+)/).to_a + go_version = run_and_match(%w[go version], /go version (.+)/).to_a puts "" puts "System information".color(:yellow) @@ -33,7 +33,7 @@ namespace :gitlab do puts "Proxy:\t\t#{proxies.present? ? proxies.color(:green) : "no"}" end - puts "Current User:\t#{run_command(%w(whoami))}" + puts "Current User:\t#{run_command(%w[whoami])}" puts "Using RVM:\t#{rvm_version.present? ? "yes".color(:green) : "no"}" puts "RVM Version:\t#{rvm_version}" if rvm_version.present? puts "Ruby Version:\t#{ruby_version || "unknown".color(:red)}" diff --git a/lib/tasks/gitlab/list_repos.rake b/lib/tasks/gitlab/list_repos.rake index 56ec94d2aef..c0929466b7c 100644 --- a/lib/tasks/gitlab/list_repos.rake +++ b/lib/tasks/gitlab/list_repos.rake @@ -2,6 +2,9 @@ namespace :gitlab do task list_repos: :environment do + warn "The Rake task gitlab:list_repos is deprecated in 16.4 and will be removed in 17.0: " \ + "https://gitlab.com/gitlab-org/gitlab/-/issues/384361" + scope = Project if ENV['SINCE'] date = Time.parse(ENV['SINCE']) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 8b305d68c68..23a518564e1 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -30,8 +30,8 @@ namespace :gitlab do File.open("config.yml", "w+") { |f| f.puts config.to_yaml } [ - %w(bin/install) + repository_storage_paths_args, - %w(make build) + %w[bin/install] + repository_storage_paths_args, + %w[make build] ].each do |cmd| unless Kernel.system(*cmd) raise "command failed: #{cmd.join(' ')}" diff --git a/lib/tasks/gitlab/update_templates.rake b/lib/tasks/gitlab/update_templates.rake index e87f478ac42..b2a255ca765 100644 --- a/lib/tasks/gitlab/update_templates.rake +++ b/lib/tasks/gitlab/update_templates.rake @@ -82,9 +82,9 @@ namespace :gitlab do Gitlab::TaskHelpers.run_command!(['tar', 'xf', 'archive.tar.gz']) extracted_project_basename = Dir['*/'].first Dir.chdir(extracted_project_basename) do - Gitlab::TaskHelpers.run_command!(%w(git init --initial-branch=master)) - Gitlab::TaskHelpers.run_command!(%W(git remote add origin #{local_remote})) - Gitlab::TaskHelpers.run_command!(%w(git add .)) + Gitlab::TaskHelpers.run_command!(%w[git init --initial-branch=master]) + Gitlab::TaskHelpers.run_command!(%W[git remote add origin #{local_remote}]) + Gitlab::TaskHelpers.run_command!(%w[git add .]) Gitlab::TaskHelpers.run_command!(['git', 'commit', '--author', 'GitLab <root@localhost>', '--message', commit_message]) Gitlab::TaskHelpers.run_command!(['git', 'push', '-u', 'origin', 'master']) end diff --git a/lib/tasks/tanuki_emoji.rake b/lib/tasks/tanuki_emoji.rake index de2ae656952..b3099853434 100644 --- a/lib/tasks/tanuki_emoji.rake +++ b/lib/tasks/tanuki_emoji.rake @@ -139,7 +139,7 @@ namespace :tanuki_emoji do puts "\n" - style_path = Rails.root.join(*%w(app assets stylesheets emoji_sprites.scss)) + style_path = Rails.root.join(*%w[app assets stylesheets emoji_sprites.scss]) print 'Compiling sprites regular sprites... ' |