Commit 149ecfba authored by Brett Walker's avatar Brett Walker Committed by Russell Dickenson

Use consistent labeling for GitLab rake tasks

Our specific rake tasks should start with ‘GitLab’
and be followed by the namespaces
eg: “GitLab | Elasticsearch | Create empty index”

Add changelog
parent e4eb5dce
---
title: Make rake -T output more consistent
merge_request: 23550
author:
type: other
...@@ -10,53 +10,53 @@ namespace :geo do ...@@ -10,53 +10,53 @@ namespace :geo do
GEO_STATUS_COLUMN_WIDTH = 40 GEO_STATUS_COLUMN_WIDTH = 40
namespace :db do |ns| namespace :db do |ns|
desc 'Drops the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.' desc 'GitLab | Geo | DB | Drops the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.'
task drop: [:environment] do task drop: [:environment] do
Gitlab::Geo::DatabaseTasks.drop_current Gitlab::Geo::DatabaseTasks.drop_current
end end
desc 'Creates the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.' desc 'GitLab | Geo | DB | Creates the Geo tracking database from config/database_geo.yml for the current RAILS_ENV.'
task create: [:environment] do task create: [:environment] do
Gitlab::Geo::DatabaseTasks.create_current Gitlab::Geo::DatabaseTasks.create_current
end end
desc 'Create the Geo tracking database, load the schema, and initialize with the seed data.' desc 'GitLab | Geo | DB | Create the Geo tracking database, load the schema, and initialize with the seed data.'
task setup: ['geo:db:schema:load', 'geo:db:seed'] task setup: ['geo:db:schema:load', 'geo:db:seed']
desc 'Migrate the Geo tracking database (options: VERSION=x, VERBOSE=false, SCOPE=blog).' desc 'GitLab | Geo | DB | Migrate the Geo tracking database (options: VERSION=x, VERBOSE=false, SCOPE=blog).'
task migrate: [:environment] do task migrate: [:environment] do
Gitlab::Geo::DatabaseTasks.migrate Gitlab::Geo::DatabaseTasks.migrate
ns['_dump'].invoke ns['_dump'].invoke
end end
desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n).' desc 'GitLab | Geo | DB | Rolls the schema back to the previous version (specify steps w/ STEP=n).'
task rollback: [:environment] do task rollback: [:environment] do
Gitlab::Geo::DatabaseTasks.rollback Gitlab::Geo::DatabaseTasks.rollback
ns['_dump'].invoke ns['_dump'].invoke
end end
desc 'Retrieves the current schema version number.' desc 'GitLab | Geo | DB | Retrieves the current schema version number.'
task version: [:environment] do task version: [:environment] do
puts "Current version: #{Gitlab::Geo::DatabaseTasks.version}" puts "Current version: #{Gitlab::Geo::DatabaseTasks.version}"
end end
desc 'Drops and recreates the database from ee/db/geo/schema.rb for the current environment and loads the seeds.' desc 'GitLab | Geo | DB | Drops and recreates the database from ee/db/geo/schema.rb for the current environment and loads the seeds.'
task reset: [:environment] do task reset: [:environment] do
ns['drop'].invoke ns['drop'].invoke
ns['create'].invoke ns['create'].invoke
ns['setup'].invoke ns['setup'].invoke
end end
desc 'Load the seed data from ee/db/geo/seeds.rb' desc 'GitLab | Geo | DB | Load the seed data from ee/db/geo/seeds.rb'
task seed: [:environment] do task seed: [:environment] do
ns['abort_if_pending_migrations'].invoke ns['abort_if_pending_migrations'].invoke
Gitlab::Geo::DatabaseTasks.load_seed Gitlab::Geo::DatabaseTasks.load_seed
end end
desc 'Refresh Foreign Tables definition in Geo Secondary node' desc 'GitLab | Geo | DB | Refresh Foreign Tables definition in Geo Secondary node'
task refresh_foreign_tables: [:environment] do task refresh_foreign_tables: [:environment] do
if Gitlab::Geo::GeoTasks.foreign_server_configured? if Gitlab::Geo::GeoTasks.foreign_server_configured?
print "\nRefreshing foreign tables for FDW: #{Gitlab::Geo::Fdw::FOREIGN_SCHEMA} ... " print "\nRefreshing foreign tables for FDW: #{Gitlab::Geo::Fdw::FOREIGN_SCHEMA} ... "
...@@ -93,12 +93,12 @@ namespace :geo do ...@@ -93,12 +93,12 @@ namespace :geo do
end end
namespace :schema do namespace :schema do
desc 'Load a schema.rb file into the database' desc 'GitLab | Geo | DB | Schema | Load a schema.rb file into the database'
task load: [:environment] do task load: [:environment] do
Gitlab::Geo::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA']) Gitlab::Geo::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA'])
end end
desc 'Create a ee/db/geo/schema.rb file that is portable against any DB supported by AR' desc 'GitLab | Geo | DB | Schema | Create a ee/db/geo/schema.rb file that is portable against any DB supported by AR'
task dump: [:environment] do task dump: [:environment] do
Gitlab::Geo::DatabaseTasks::Schema.dump Gitlab::Geo::DatabaseTasks::Schema.dump
...@@ -107,21 +107,21 @@ namespace :geo do ...@@ -107,21 +107,21 @@ namespace :geo do
end end
namespace :migrate do namespace :migrate do
desc 'Runs the "up" for a given migration VERSION.' desc 'GitLab | Geo | DB | Migrate | Runs the "up" for a given migration VERSION.'
task up: [:environment] do task up: [:environment] do
Gitlab::Geo::DatabaseTasks::Migrate.up Gitlab::Geo::DatabaseTasks::Migrate.up
ns['_dump'].invoke ns['_dump'].invoke
end end
desc 'Runs the "down" for a given migration VERSION.' desc 'GitLab | Geo | DB | Migrate | Runs the "down" for a given migration VERSION.'
task down: [:environment] do task down: [:environment] do
Gitlab::Geo::DatabaseTasks::Migrate.down Gitlab::Geo::DatabaseTasks::Migrate.down
ns['_dump'].invoke ns['_dump'].invoke
end end
desc 'Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).' desc 'GitLab | Geo | DB | Migrate | Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).'
task redo: [:environment] do task redo: [:environment] do
if ENV['VERSION'] if ENV['VERSION']
ns['migrate:down'].invoke ns['migrate:down'].invoke
...@@ -132,14 +132,14 @@ namespace :geo do ...@@ -132,14 +132,14 @@ namespace :geo do
end end
end end
desc 'Display status of migrations' desc 'GitLab | Geo | DB | Migrate | Display status of migrations'
task status: [:environment] do task status: [:environment] do
Gitlab::Geo::DatabaseTasks::Migrate.status Gitlab::Geo::DatabaseTasks::Migrate.status
end end
end end
namespace :test do namespace :test do
desc 'Check for pending migrations and load the test schema' desc 'GitLab | Geo | DB | Test | Check for pending migrations and load the test schema'
task prepare: [:environment] do task prepare: [:environment] do
ns['test:load'].invoke ns['test:load'].invoke
end end
...@@ -154,7 +154,7 @@ namespace :geo do ...@@ -154,7 +154,7 @@ namespace :geo do
Gitlab::Geo::DatabaseTasks::Test.purge Gitlab::Geo::DatabaseTasks::Test.purge
end end
desc 'Refresh Foreign Tables definition for test environment' desc 'GitLab | Geo | DB | Test | Refresh Foreign Tables definition for test environment'
task refresh_foreign_tables: [:environment] do task refresh_foreign_tables: [:environment] do
old_env = ActiveRecord::Tasks::DatabaseTasks.env old_env = ActiveRecord::Tasks::DatabaseTasks.env
ActiveRecord::Tasks::DatabaseTasks.env = 'test' ActiveRecord::Tasks::DatabaseTasks.env = 'test'
...@@ -166,7 +166,7 @@ namespace :geo do ...@@ -166,7 +166,7 @@ namespace :geo do
end end
end end
desc 'Run orphaned project registry cleaner' desc 'GitLab | Geo | Run orphaned project registry cleaner'
task run_orphaned_project_registry_cleaner: :environment do task run_orphaned_project_registry_cleaner: :environment do
abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows? abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows?
...@@ -206,7 +206,7 @@ namespace :geo do ...@@ -206,7 +206,7 @@ namespace :geo do
puts "Orphaned registries removed(total): #{total_count}" puts "Orphaned registries removed(total): #{total_count}"
end end
desc 'Make this node the Geo primary' desc 'GitLab | Geo | Make this node the Geo primary'
task set_primary_node: :environment do task set_primary_node: :environment do
abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows? abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows?
abort 'GitLab Geo primary node already present' if Gitlab::Geo.primary_node.present? abort 'GitLab Geo primary node already present' if Gitlab::Geo.primary_node.present?
...@@ -214,7 +214,7 @@ namespace :geo do ...@@ -214,7 +214,7 @@ namespace :geo do
Gitlab::Geo::GeoTasks.set_primary_geo_node Gitlab::Geo::GeoTasks.set_primary_geo_node
end end
desc 'Make this secondary node the primary' desc 'GitLab | Geo | Make this secondary node the primary'
task set_secondary_as_primary: :environment do task set_secondary_as_primary: :environment do
abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows? abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows?
...@@ -237,14 +237,14 @@ namespace :geo do ...@@ -237,14 +237,14 @@ namespace :geo do
end end
end end
desc 'Update Geo primary node URL' desc 'GitLab | Geo | Update Geo primary node URL'
task update_primary_node_url: :environment do task update_primary_node_url: :environment do
abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows? abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows?
Gitlab::Geo::GeoTasks.update_primary_geo_node_url Gitlab::Geo::GeoTasks.update_primary_geo_node_url
end end
desc 'Print Geo node status' desc 'GitLab | Geo | Print Geo node status'
task status: :environment do task status: :environment do
abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows? abort GEO_LICENSE_ERROR_TEXT unless Gitlab::Geo.license_allows?
......
...@@ -3,17 +3,17 @@ namespace :geo do ...@@ -3,17 +3,17 @@ namespace :geo do
namespace :housekeeping do namespace :housekeeping do
using ProgressBar::Refinements::Enumerator using ProgressBar::Refinements::Enumerator
desc "GitLab | Git | Housekeeping | Garbage Collection" desc "GitLab | Geo | Git | Housekeeping | Garbage Collection"
task gc: :gitlab_environment do task gc: :gitlab_environment do
flag_for_housekeeping(Gitlab::CurrentSettings.housekeeping_gc_period) flag_for_housekeeping(Gitlab::CurrentSettings.housekeeping_gc_period)
end end
desc "GitLab | Git | Housekeeping | Full Repack" desc "GitLab | Geo | Git | Housekeeping | Full Repack"
task full_repack: :gitlab_environment do task full_repack: :gitlab_environment do
flag_for_housekeeping(Gitlab::CurrentSettings.housekeeping_full_repack_period) flag_for_housekeeping(Gitlab::CurrentSettings.housekeeping_full_repack_period)
end end
desc "GitLab | Git | Housekeeping | Incremental Repack" desc "GitLab | Geo | Git | Housekeeping | Incremental Repack"
task incremental_repack: :gitlab_environment do task incremental_repack: :gitlab_environment do
flag_for_housekeeping(Gitlab::CurrentSettings.housekeeping_incremental_repack_period) flag_for_housekeeping(Gitlab::CurrentSettings.housekeeping_incremental_repack_period)
end end
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
namespace :geo do namespace :geo do
namespace :verification do namespace :verification do
namespace :repository do namespace :repository do
desc "GitLab | Verification | Repository | Reset | Resync repositories where verification has failed" desc "GitLab | Verification | Repository | Resync repositories where verification has failed"
task reset: :gitlab_environment do task reset: :gitlab_environment do
flag_for_resync(:repository) flag_for_resync(:repository)
end end
end end
namespace :wiki do namespace :wiki do
desc "GitLab | Verification | Wiki | Reset | Resync wiki repositories where verification has failed" desc "GitLab | Verification | Wiki | Resync wiki repositories where verification has failed"
task reset: :gitlab_environment do task reset: :gitlab_environment do
flag_for_resync(:wiki) flag_for_resync(:wiki)
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace :gitlab do namespace :gitlab do
namespace :geo do namespace :geo do
desc 'GitLab | Check Geo configuration and dependencies' desc 'GitLab | Geo | Check Geo configuration and dependencies'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::GeoTask.run! SystemCheck::RakeTask::GeoTask.run!
end end
......
namespace :gitlab do namespace :gitlab do
namespace :db do namespace :db do
desc 'Output pseudonymity dump of selected tables' desc 'GitLab | DB | Output pseudonymity dump of selected tables'
task pseudonymizer: :environment do task pseudonymizer: :environment do
abort "The pseudonymizer is not available with this license." unless License.feature_available?(:pseudonymizer) abort "The pseudonymizer is not available with this license." unless License.feature_available?(:pseudonymizer)
abort "The pseudonymizer is disabled." unless Gitlab::CurrentSettings.pseudonymizer_enabled? abort "The pseudonymizer is disabled." unless Gitlab::CurrentSettings.pseudonymizer_enabled?
......
namespace :gitlab do namespace :gitlab do
namespace :indexer do namespace :indexer do
desc "GitLab | Install or upgrade gitlab-elasticsearch-indexer" desc "GitLab | Indexer | Install or upgrade gitlab-elasticsearch-indexer"
task :install, [:dir, :repo] => :gitlab_environment do |t, args| task :install, [:dir, :repo] => :gitlab_environment do |t, args|
unless args.dir.present? unless args.dir.present?
abort %(Please specify the directory where you want to install the indexer abort %(Please specify the directory where you want to install the indexer
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace :gitlab do namespace :gitlab do
namespace :license do namespace :license do
desc 'GitLab | Gather license related information' desc 'GitLab | License | Gather license related information'
task info: :gitlab_environment do task info: :gitlab_environment do
license = Gitlab::UsageData.license_usage_data license = Gitlab::UsageData.license_usage_data
puts "Today's Date: #{Date.today}" puts "Today's Date: #{Date.today}"
......
require 'logger' require 'logger'
desc "GitLab | Migrate packages files to remote storage" desc "GitLab | Packages | Migrate packages files to remote storage"
namespace :gitlab do namespace :gitlab do
namespace :packages do namespace :packages do
task migrate: :environment do task migrate: :environment do
......
desc "GITLAB | migrate provider names to multiple ldap setup" desc "GitLab | Migrate provider names to multiple LDAP setup"
namespace :gitlab do namespace :gitlab do
task migrate_ldap_providers: :environment do task migrate_ldap_providers: :environment do
config = Gitlab::Auth::LDAP::Config config = Gitlab::Auth::LDAP::Config
......
...@@ -3,7 +3,7 @@ namespace :cache do ...@@ -3,7 +3,7 @@ namespace :cache do
REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000 REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000
REDIS_SCAN_START_STOP = '0'.freeze # Magic value, see http://redis.io/commands/scan REDIS_SCAN_START_STOP = '0'.freeze # Magic value, see http://redis.io/commands/scan
desc "GitLab | Clear redis cache" desc "GitLab | Cache | Clear redis cache"
task redis: :environment do task redis: :environment do
Gitlab::Redis::Cache.with do |redis| Gitlab::Redis::Cache.with do |redis|
cache_key_pattern = %W[#{Gitlab::Redis::Cache::CACHE_NAMESPACE}* cache_key_pattern = %W[#{Gitlab::Redis::Cache::CACHE_NAMESPACE}*
......
namespace :ci do namespace :ci do
namespace :cleanup do namespace :cleanup do
desc "GitLab CI | Clean running builds" desc "GitLab | CI | Clean running builds"
task builds: :environment do task builds: :environment do
Ci::Build.running.update_all(status: 'canceled') Ci::Build.running.update_all(status: 'canceled')
end end
......
task dev: ["dev:setup"] task dev: ["dev:setup"]
namespace :dev do namespace :dev do
desc "GitLab | Setup developer environment (db, fixtures)" desc "GitLab | Dev | Setup developer environment (db, fixtures)"
task setup: :environment do task setup: :environment do
ENV['force'] = 'yes' ENV['force'] = 'yes'
Rake::Task["gitlab:setup"].invoke Rake::Task["gitlab:setup"].invoke
...@@ -12,7 +12,7 @@ namespace :dev do ...@@ -12,7 +12,7 @@ namespace :dev do
Rake::Task["gitlab:shell:setup"].invoke Rake::Task["gitlab:shell:setup"].invoke
end end
desc "GitLab | Eager load application" desc "GitLab | Dev | Eager load application"
task load: :environment do task load: :environment do
Rails.configuration.eager_load = true Rails.configuration.eager_load = true
Rails.application.eager_load! Rails.application.eager_load!
......
require 'logger' require 'logger'
require 'resolv-replace' require 'resolv-replace'
desc "GitLab | Migrate files for artifacts to comply with new storage format" desc 'GitLab | Artifacts | Migrate files for artifacts to comply with new storage format'
namespace :gitlab do namespace :gitlab do
namespace :artifacts do namespace :artifacts do
task migrate: :environment do task migrate: :environment do
......
...@@ -3,18 +3,18 @@ require 'active_record/fixtures' ...@@ -3,18 +3,18 @@ require 'active_record/fixtures'
namespace :gitlab do namespace :gitlab do
namespace :backup do namespace :backup do
# Create backup of GitLab system # Create backup of GitLab system
desc "GitLab | Create a backup of the GitLab system" desc 'GitLab | Backup | Create a backup of the GitLab system'
task create: :gitlab_environment do task create: :gitlab_environment do
warn_user_is_not_gitlab warn_user_is_not_gitlab
Rake::Task["gitlab:backup:db:create"].invoke Rake::Task['gitlab:backup:db:create'].invoke
Rake::Task["gitlab:backup:repo:create"].invoke Rake::Task['gitlab:backup:repo:create'].invoke
Rake::Task["gitlab:backup:uploads:create"].invoke Rake::Task['gitlab:backup:uploads:create'].invoke
Rake::Task["gitlab:backup:builds:create"].invoke Rake::Task['gitlab:backup:builds:create'].invoke
Rake::Task["gitlab:backup:artifacts:create"].invoke Rake::Task['gitlab:backup:artifacts:create'].invoke
Rake::Task["gitlab:backup:pages:create"].invoke Rake::Task['gitlab:backup:pages:create'].invoke
Rake::Task["gitlab:backup:lfs:create"].invoke Rake::Task['gitlab:backup:lfs:create'].invoke
Rake::Task["gitlab:backup:registry:create"].invoke Rake::Task['gitlab:backup:registry:create'].invoke
backup = Backup::Manager.new(progress) backup = Backup::Manager.new(progress)
backup.pack backup.pack
...@@ -28,7 +28,7 @@ namespace :gitlab do ...@@ -28,7 +28,7 @@ namespace :gitlab do
end end
# Restore backup of GitLab system # Restore backup of GitLab system
desc 'GitLab | Restore a previously created backup' desc 'GitLab | Backup | Restore a previously created backup'
task restore: :gitlab_environment do task restore: :gitlab_environment do
warn_user_is_not_gitlab warn_user_is_not_gitlab
......
namespace :gitlab do namespace :gitlab do
namespace :import do namespace :import do
desc "GitLab | Add all users to all projects (admin users are added as maintainers)" desc "GitLab | Import | Add all users to all projects (admin users are added as maintainers)"
task all_users_to_all_projects: :environment do |t, args| task all_users_to_all_projects: :environment do |t, args|
user_ids = User.where(admin: false).pluck(:id) user_ids = User.where(admin: false).pluck(:id)
admin_ids = User.where(admin: true).pluck(:id) admin_ids = User.where(admin: true).pluck(:id)
...@@ -13,7 +13,7 @@ namespace :gitlab do ...@@ -13,7 +13,7 @@ namespace :gitlab do
ProjectMember.add_users_to_projects(project_ids, admin_ids, ProjectMember::MAINTAINER) ProjectMember.add_users_to_projects(project_ids, admin_ids, ProjectMember::MAINTAINER)
end end
desc "GitLab | Add a specific user to all projects (as a developer)" desc "GitLab | Import | Add a specific user to all projects (as a developer)"
task :user_to_projects, [:email] => :environment do |t, args| task :user_to_projects, [:email] => :environment do |t, args|
user = User.find_by(email: args.email) user = User.find_by(email: args.email)
project_ids = Project.pluck(:id) project_ids = Project.pluck(:id)
...@@ -21,7 +21,7 @@ namespace :gitlab do ...@@ -21,7 +21,7 @@ namespace :gitlab do
ProjectMember.add_users_to_projects(project_ids, Array.wrap(user.id), ProjectMember::DEVELOPER) ProjectMember.add_users_to_projects(project_ids, Array.wrap(user.id), ProjectMember::DEVELOPER)
end end
desc "GitLab | Add all users to all groups (admin users are added as owners)" desc "GitLab | Import | Add all users to all groups (admin users are added as owners)"
task all_users_to_all_groups: :environment do |t, args| task all_users_to_all_groups: :environment do |t, args|
user_ids = User.where(admin: false).pluck(:id) user_ids = User.where(admin: false).pluck(:id)
admin_ids = User.where(admin: true).pluck(:id) admin_ids = User.where(admin: true).pluck(:id)
...@@ -35,7 +35,7 @@ namespace :gitlab do ...@@ -35,7 +35,7 @@ namespace :gitlab do
end end
end end
desc "GitLab | Add a specific user to all groups (as a developer)" desc "GitLab | Import | Add a specific user to all groups (as a developer)"
task :user_to_groups, [:email] => :environment do |t, args| task :user_to_groups, [:email] => :environment do |t, args|
user = User.find_by_email args.email user = User.find_by_email args.email
groups = Group.all groups = Group.all
......
...@@ -5,35 +5,35 @@ namespace :gitlab do ...@@ -5,35 +5,35 @@ namespace :gitlab do
end end
namespace :app do namespace :app do
desc 'GitLab | Check the configuration of the GitLab Rails app' desc 'GitLab | App | Check the configuration of the GitLab Rails app'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::AppTask.run! SystemCheck::RakeTask::AppTask.run!
end end
end end
namespace :gitlab_shell do namespace :gitlab_shell do
desc "GitLab | Check the configuration of GitLab Shell" desc 'GitLab | GitLab Shell | Check the configuration of GitLab Shell'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::GitlabShellTask.run! SystemCheck::RakeTask::GitlabShellTask.run!
end end
end end
namespace :gitaly do namespace :gitaly do
desc 'GitLab | Check the health of Gitaly' desc 'GitLab | Gitaly | Check the health of Gitaly'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::GitalyTask.run! SystemCheck::RakeTask::GitalyTask.run!
end end
end end
namespace :sidekiq do namespace :sidekiq do
desc "GitLab | Check the configuration of Sidekiq" desc 'GitLab | Sidekiq | Check the configuration of Sidekiq'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::SidekiqTask.run! SystemCheck::RakeTask::SidekiqTask.run!
end end
end end
namespace :incoming_email do namespace :incoming_email do
desc "GitLab | Check the configuration of Reply by email" desc 'GitLab | Incoming Email | Check the configuration of Reply by email'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::IncomingEmailTask.run! SystemCheck::RakeTask::IncomingEmailTask.run!
end end
...@@ -48,17 +48,17 @@ namespace :gitlab do ...@@ -48,17 +48,17 @@ namespace :gitlab do
end end
namespace :orphans do namespace :orphans do
desc 'Gitlab | Check for orphaned namespaces and repositories' desc 'Gitlab | Orphans | Check for orphaned namespaces and repositories'
task check: :gitlab_environment do task check: :gitlab_environment do
SystemCheck::RakeTask::OrphansTask.run! SystemCheck::RakeTask::OrphansTask.run!
end end
desc 'GitLab | Check for orphaned namespaces in the repositories path' desc 'GitLab | Orphans | Check for orphaned namespaces in the repositories path'
task check_namespaces: :gitlab_environment do task check_namespaces: :gitlab_environment do
SystemCheck::RakeTask::Orphans::NamespaceTask.run! SystemCheck::RakeTask::Orphans::NamespaceTask.run!
end end
desc 'GitLab | Check for orphaned repositories in the repositories path' desc 'GitLab | Orphans | Check for orphaned repositories in the repositories path'
task check_repositories: :gitlab_environment do task check_repositories: :gitlab_environment do
SystemCheck::RakeTask::Orphans::RepositoryTask.run! SystemCheck::RakeTask::Orphans::RepositoryTask.run!
end end
......
namespace :gitlab do namespace :gitlab do
namespace :db do namespace :db do
desc 'GitLab | Manually insert schema migration version' desc 'GitLab | DB | Manually insert schema migration version'
task :mark_migration_complete, [:version] => :environment do |_, args| task :mark_migration_complete, [:version] => :environment do |_, args|
unless args[:version] unless args[:version]
puts "Must specify a migration version as an argument".color(:red) puts "Must specify a migration version as an argument".color(:red)
...@@ -22,7 +22,7 @@ namespace :gitlab do ...@@ -22,7 +22,7 @@ namespace :gitlab do
end end
end end
desc 'Drop all tables' desc 'GitLab | DB | Drop all tables'
task drop_tables: :environment do task drop_tables: :environment do
connection = ActiveRecord::Base.connection connection = ActiveRecord::Base.connection
...@@ -41,7 +41,7 @@ namespace :gitlab do ...@@ -41,7 +41,7 @@ namespace :gitlab do
tables.each { |t| connection.execute("DROP TABLE IF EXISTS #{connection.quote_table_name(t)} CASCADE") } tables.each { |t| connection.execute("DROP TABLE IF EXISTS #{connection.quote_table_name(t)} CASCADE") }
end end
desc 'Configures the database by running migrate, or by loading the schema and seeding if needed' desc 'GitLab | DB | Configures the database by running migrate, or by loading the schema and seeding if needed'
task configure: :environment do task configure: :environment do
# Check if we have existing db tables # Check if we have existing db tables
# The schema_migrations table will still exist if drop_tables was called # The schema_migrations table will still exist if drop_tables was called
...@@ -55,7 +55,7 @@ namespace :gitlab do ...@@ -55,7 +55,7 @@ namespace :gitlab do
end end
end end
desc 'Checks if migrations require downtime or not' desc 'GitLab | DB | Checks if migrations require downtime or not'
task :downtime_check, [:ref] => :environment do |_, args| task :downtime_check, [:ref] => :environment do |_, args|
abort 'You must specify a Git reference to compare with' unless args[:ref] abort 'You must specify a Git reference to compare with' unless args[:ref]
...@@ -71,7 +71,7 @@ namespace :gitlab do ...@@ -71,7 +71,7 @@ namespace :gitlab do
Gitlab::DowntimeCheck.new.check_and_print(migrations) Gitlab::DowntimeCheck.new.check_and_print(migrations)
end end
desc 'Sets up EE specific database functionality' desc 'GitLab | DB | Sets up EE specific database functionality'
if Gitlab.ee? if Gitlab.ee?
task setup_ee: %w[geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate] task setup_ee: %w[geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate]
......
namespace :gitlab do namespace :gitlab do
namespace :exclusive_lease do namespace :exclusive_lease do
desc 'GitLab | Clear existing exclusive leases for specified scope (default: *)' desc 'GitLab | Exclusive Lease | Clear existing exclusive leases for specified scope (default: *)'
task :clear, [:scope] => [:environment] do |_, args| task :clear, [:scope] => [:environment] do |_, args|
args[:scope].nil? ? Gitlab::ExclusiveLease.reset_all! : Gitlab::ExclusiveLease.reset_all!(args[:scope]) args[:scope].nil? ? Gitlab::ExclusiveLease.reset_all! : Gitlab::ExclusiveLease.reset_all!(args[:scope])
puts 'All exclusive lease entries were removed.' puts 'All exclusive lease entries were removed.'
......
namespace :gitlab do namespace :gitlab do
namespace :gitaly do namespace :gitaly do
desc "GitLab | Install or upgrade gitaly" desc 'GitLab | Gitaly | Install or upgrade gitaly'
task :install, [:dir, :storage_path, :repo] => :gitlab_environment do |t, args| task :install, [:dir, :storage_path, :repo] => :gitlab_environment do |t, args|
warn_user_is_not_gitlab warn_user_is_not_gitlab
......
...@@ -21,7 +21,7 @@ namespace :gitlab do ...@@ -21,7 +21,7 @@ namespace :gitlab do
) )
namespace :graphql do namespace :graphql do
desc 'GitLab | Generate GraphQL docs' desc 'GitLab | GraphQL | Generate GraphQL docs'
task compile_docs: :environment do task compile_docs: :environment do
renderer = Gitlab::Graphql::Docs::Renderer.new(GitlabSchema.graphql_definition, render_options) renderer = Gitlab::Graphql::Docs::Renderer.new(GitlabSchema.graphql_definition, render_options)
...@@ -30,7 +30,7 @@ namespace :gitlab do ...@@ -30,7 +30,7 @@ namespace :gitlab do
puts "Documentation compiled." puts "Documentation compiled."
end end
desc 'GitLab | Check if GraphQL docs are up to date' desc 'GitLab | GraphQL | Check if GraphQL docs are up to date'
task check_docs: :environment do task check_docs: :environment do
renderer = Gitlab::Graphql::Docs::Renderer.new(GitlabSchema.graphql_definition, render_options) renderer = Gitlab::Graphql::Docs::Renderer.new(GitlabSchema.graphql_definition, render_options)
...@@ -44,7 +44,7 @@ namespace :gitlab do ...@@ -44,7 +44,7 @@ namespace :gitlab do
end end
end end
desc 'GitLab | Check if GraphQL schemas are up to date' desc 'GitLab | GraphQL | Check if GraphQL schemas are up to date'
task check_schema: :environment do task check_schema: :environment do
idl_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.graphql')) idl_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.graphql'))
json_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.json')) json_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.json'))
......
...@@ -8,7 +8,7 @@ namespace :gitlab do ...@@ -8,7 +8,7 @@ namespace :gitlab do
# Notes: # Notes:
# * The project owner will set to the first administator of the system # * The project owner will set to the first administator of the system
# * Existing projects will be skipped # * Existing projects will be skipped
desc "GitLab | Import bare repositories from repositories -> storages into GitLab project instance" desc "GitLab | Import | Import bare repositories from repositories -> storages into GitLab project instance"
task :repos, [:import_path] => :environment do |_t, args| task :repos, [:import_path] => :environment do |_t, args|
unless args.import_path unless args.import_path
puts 'Please specify an import path that contains the repositories'.color(:red) puts 'Please specify an import path that contains the repositories'.color(:red)
......
namespace :gitlab do namespace :gitlab do
namespace :import_export do namespace :import_export do
desc "GitLab | Show Import/Export version" desc 'GitLab | Import/Export | Show Import/Export version'
task version: :environment do task version: :environment do
puts "Import/Export v#{Gitlab::ImportExport.version}" puts "Import/Export v#{Gitlab::ImportExport.version}"
end end
desc "GitLab | Display exported DB structure" desc 'GitLab | Import/Export | Display exported DB structure'
task data: :environment do task data: :environment do
puts Gitlab::ImportExport::Config.new.to_h['project_tree'].to_yaml(SortKeys: true) puts Gitlab::ImportExport::Config.new.to_h['project_tree'].to_yaml(SortKeys: true)
end end
desc 'GitLab | Bumps the Import/Export version in fixtures and project templates' desc 'GitLab | Import/Export | Bumps the Import/Export version in fixtures and project templates'
task bump_version: :environment do task bump_version: :environment do
archives = Dir['vendor/project_templates/*.tar.gz'] archives = Dir['vendor/project_templates/*.tar.gz']
archives.push('spec/features/projects/import_export/test_project_export.tar.gz') archives.push('spec/features/projects/import_export/test_project_export.tar.gz')
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
namespace :gitlab do namespace :gitlab do
namespace :import_export do namespace :import_export do
desc 'EXPERIMENTAL | Import large project archives' desc 'GitLab | Import/Export | EXPERIMENTAL | Import large project archives'
task :import, [:username, :namespace_path, :project_path, :archive_path] => :gitlab_environment do |_t, args| task :import, [:username, :namespace_path, :project_path, :archive_path] => :gitlab_environment do |_t, args|
# Load it here to avoid polluting Rake tasks with Sidekiq test warnings # Load it here to avoid polluting Rake tasks with Sidekiq test warnings
require 'sidekiq/testing' require 'sidekiq/testing'
......
namespace :gitlab do namespace :gitlab do
namespace :env do namespace :env do
desc "GitLab | Show information about GitLab and its environment" desc 'GitLab | Env | Show information about GitLab and its environment'
task info: :gitlab_environment do task info: :gitlab_environment do
# check if there is an RVM environment # 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)
......
require 'logger' require 'logger'
desc "GitLab | Migrate LFS objects to remote storage" desc "GitLab | LFS | Migrate LFS objects to remote storage"
namespace :gitlab do namespace :gitlab do
namespace :lfs do namespace :lfs do
task migrate: :environment do task migrate: :environment do
......
# frozen_string_literal: true # frozen_string_literal: true
namespace :metrics do namespace :metrics do
desc "GitLab | Setup common metrics" desc "GitLab | Metrics | Setup common metrics"
task setup_common_metrics: :gitlab_environment do task setup_common_metrics: :gitlab_environment do
::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
end end
......
namespace :gitlab do namespace :gitlab do
namespace :shell do namespace :shell do
desc "GitLab | Install or upgrade gitlab-shell" desc "GitLab | Shell | Install or upgrade gitlab-shell"
task :install, [:repo] => :gitlab_environment do |t, args| task :install, [:repo] => :gitlab_environment do |t, args|
warn_user_is_not_gitlab warn_user_is_not_gitlab
...@@ -54,12 +54,12 @@ namespace :gitlab do ...@@ -54,12 +54,12 @@ namespace :gitlab do
Gitlab::Shell.ensure_secret_token! Gitlab::Shell.ensure_secret_token!
end end
desc "GitLab | Setup gitlab-shell" desc "GitLab | Shell | Setup gitlab-shell"
task setup: :gitlab_environment do task setup: :gitlab_environment do
setup setup
end end
desc "GitLab | Build missing projects" desc "GitLab | Shell | Build missing projects"
task build_missing_projects: :gitlab_environment do task build_missing_projects: :gitlab_environment do
Project.find_each(batch_size: 1000) do |project| Project.find_each(batch_size: 1000) do |project|
path_to_repo = project.repository.path_to_repo path_to_repo = project.repository.path_to_repo
......
...@@ -16,7 +16,7 @@ namespace :gitlab do ...@@ -16,7 +16,7 @@ namespace :gitlab do
File.write(path, banner + YAML.dump(object)) File.write(path, banner + YAML.dump(object))
end end
desc 'GitLab | Generate all_queues.yml based on worker definitions' desc 'GitLab | Sidekiq | Generate all_queues.yml based on worker definitions'
task generate: :environment do task generate: :environment do
foss_workers, ee_workers = Gitlab::SidekiqConfig.workers_for_all_queues_yml foss_workers, ee_workers = Gitlab::SidekiqConfig.workers_for_all_queues_yml
...@@ -27,7 +27,7 @@ namespace :gitlab do ...@@ -27,7 +27,7 @@ namespace :gitlab do
end end
end end
desc 'GitLab | Validate that all_queues.yml matches worker definitions' desc 'GitLab | Sidekiq | Validate that all_queues.yml matches worker definitions'
task check: :environment do task check: :environment do
if Gitlab::SidekiqConfig.all_queues_yml_outdated? if Gitlab::SidekiqConfig.all_queues_yml_outdated?
raise <<~MSG raise <<~MSG
......
namespace :gitlab do namespace :gitlab do
namespace :two_factor do namespace :two_factor do
desc "GitLab | Disable Two-factor authentication (2FA) for all users" desc "GitLab | 2FA | Disable Two-factor authentication (2FA) for all users"
task disable_for_all_users: :gitlab_environment do task disable_for_all_users: :gitlab_environment do
scope = User.with_two_factor scope = User.with_two_factor
count = scope.count count = scope.count
...@@ -25,12 +25,12 @@ namespace :gitlab do ...@@ -25,12 +25,12 @@ namespace :gitlab do
@rotator ||= Gitlab::OtpKeyRotator.new(ENV['filename']) @rotator ||= Gitlab::OtpKeyRotator.new(ENV['filename'])
end end
desc "Encrypt user OTP secrets with a new encryption key" desc "GitLab | 2FA | Rotate Key | Encrypt user OTP secrets with a new encryption key"
task apply: :environment do |t, args| task apply: :environment do |t, args|
rotator.rotate!(old_key: ENV['old_key'], new_key: ENV['new_key']) rotator.rotate!(old_key: ENV['old_key'], new_key: ENV['new_key'])
end end
desc "Rollback to secrets encrypted with the old encryption key" desc "GitLab | 2FA | Rotate Key | Rollback to secrets encrypted with the old encryption key"
task rollback: :environment do task rollback: :environment do
rotator.rollback! rotator.rollback!
end end
......
namespace :gitlab do namespace :gitlab do
namespace :web_hook do namespace :web_hook do
desc "GitLab | Adds a webhook to the projects" desc "GitLab | Webhook | Adds a webhook to the projects"
task add: :environment do task add: :environment do
web_hook_url = ENV['URL'] web_hook_url = ENV['URL']
namespace_path = ENV['NAMESPACE'] namespace_path = ENV['NAMESPACE']
...@@ -20,7 +20,7 @@ namespace :gitlab do ...@@ -20,7 +20,7 @@ namespace :gitlab do
end end
end end
desc "GitLab | Remove a webhook from the projects" desc "GitLab | Webhook | Remove a webhook from the projects"
task rm: :environment do task rm: :environment do
web_hook_url = ENV['URL'] web_hook_url = ENV['URL']
namespace_path = ENV['NAMESPACE'] namespace_path = ENV['NAMESPACE']
...@@ -44,7 +44,7 @@ namespace :gitlab do ...@@ -44,7 +44,7 @@ namespace :gitlab do
puts "#{count} webhooks were removed." puts "#{count} webhooks were removed."
end end
desc "GitLab | List webhooks" desc "GitLab | Webhook | List webhooks"
task list: :environment do task list: :environment do
namespace_path = ENV['NAMESPACE'] namespace_path = ENV['NAMESPACE']
......
namespace :gitlab do namespace :gitlab do
namespace :workhorse do namespace :workhorse do
desc "GitLab | Install or upgrade gitlab-workhorse" desc "GitLab | Workhorse | Install or upgrade gitlab-workhorse"
task :install, [:dir, :repo] => :gitlab_environment do |t, args| task :install, [:dir, :repo] => :gitlab_environment do |t, args|
warn_user_is_not_gitlab warn_user_is_not_gitlab
......
...@@ -138,7 +138,7 @@ class GithubRepos ...@@ -138,7 +138,7 @@ class GithubRepos
end end
namespace :import do namespace :import do
desc 'Import a GitHub project - Example: import:github[ToKeN,root,root/blah,my/github_repo] (optional my/github_repo)' desc 'GitLab | Import | Import a GitHub project - Example: import:github[ToKeN,root,root/blah,my/github_repo] (optional my/github_repo)'
task :github, [:token, :gitlab_username, :project_path] => :environment do |_t, args| task :github, [:token, :gitlab_username, :project_path] => :environment do |_t, args|
abort 'Project path must be: namespace(s)/project_name'.color(:red) unless args.project_path.include?('/') abort 'Project path must be: namespace(s)/project_name'.color(:red) unless args.project_path.include?('/')
......
...@@ -4,7 +4,7 @@ unless Rails.env.production? ...@@ -4,7 +4,7 @@ unless Rails.env.production?
ENV['STATIC_VERIFICATION'] = 'true' ENV['STATIC_VERIFICATION'] = 'true'
end end
desc "GitLab | lint | Static verification" desc "GitLab | Lint | Static verification"
task static_verification: %w[ task static_verification: %w[
lint:static_verification_env lint:static_verification_env
dev:load dev:load
...@@ -12,19 +12,19 @@ unless Rails.env.production? ...@@ -12,19 +12,19 @@ unless Rails.env.production?
Gitlab::Utils::Override.verify! Gitlab::Utils::Override.verify!
end end
desc "GitLab | lint | Lint JavaScript files using ESLint" desc "GitLab | Lint | Lint JavaScript files using ESLint"
task :javascript do task :javascript do
Rake::Task['eslint'].invoke Rake::Task['eslint'].invoke
end end
desc "GitLab | lint | Lint HAML files" desc "GitLab | Lint | Lint HAML files"
task :haml do task :haml do
Rake::Task['haml_lint'].invoke Rake::Task['haml_lint'].invoke
rescue RuntimeError # The haml_lint tasks raise a RuntimeError rescue RuntimeError # The haml_lint tasks raise a RuntimeError
exit(1) exit(1)
end end
desc "GitLab | lint | Run several lint checks" desc "GitLab | Lint | Run several lint checks"
task :all do task :all do
status = 0 status = 0
......
namespace :gitlab do namespace :gitlab do
namespace :db do namespace :db do
desc 'GitLab | Adds primary keys to tables that only have composite unique keys' desc 'GitLab | DB | Adds primary keys to tables that only have composite unique keys'
task composite_primary_keys_add: :environment do task composite_primary_keys_add: :environment do
require Rails.root.join('db/optional_migrations/composite_primary_keys') require Rails.root.join('db/optional_migrations/composite_primary_keys')
CompositePrimaryKeysMigration.new.up CompositePrimaryKeysMigration.new.up
end end
desc 'GitLab | Removes previously added composite primary keys' desc 'GitLab | DB | Removes previously added composite primary keys'
task composite_primary_keys_drop: :environment do task composite_primary_keys_drop: :environment do
require Rails.root.join('db/optional_migrations/composite_primary_keys') require Rails.root.join('db/optional_migrations/composite_primary_keys')
CompositePrimaryKeysMigration.new.down CompositePrimaryKeysMigration.new.down
......
...@@ -53,7 +53,7 @@ namespace :pngquant do ...@@ -53,7 +53,7 @@ namespace :pngquant do
end end
end end
desc 'GitLab | pngquant | Compress all documentation PNG images using pngquant' desc 'GitLab | Pngquant | Compress all documentation PNG images using pngquant'
task :compress do task :compress do
check_executable check_executable
...@@ -69,7 +69,7 @@ namespace :pngquant do ...@@ -69,7 +69,7 @@ namespace :pngquant do
end end
end end
desc 'GitLab | pngquant | Checks that all documentation PNG images have been compressed with pngquant' desc 'GitLab | Pngquant | Checks that all documentation PNG images have been compressed with pngquant'
task :lint do task :lint do
check_executable check_executable
......
...@@ -8,28 +8,28 @@ namespace :sidekiq do ...@@ -8,28 +8,28 @@ namespace :sidekiq do
WARNING WARNING
end end
desc "[DEPRECATED] GitLab | Stop sidekiq" desc '[DEPRECATED] GitLab | Sidekiq | Stop sidekiq'
task :stop do task :stop do
deprecation_warning! deprecation_warning!
system(*%w(bin/background_jobs stop)) system(*%w(bin/background_jobs stop))
end end
desc "[DEPRECATED] GitLab | Start sidekiq" desc '[DEPRECATED] GitLab | Sidekiq | Start sidekiq'
task :start do task :start do
deprecation_warning! deprecation_warning!
system(*%w(bin/background_jobs start)) system(*%w(bin/background_jobs start))
end end
desc '[DEPRECATED] GitLab | Restart sidekiq' desc '[DEPRECATED] GitLab | Sidekiq | Restart sidekiq'
task :restart do task :restart do
deprecation_warning! deprecation_warning!
system(*%w(bin/background_jobs restart)) system(*%w(bin/background_jobs restart))
end end
desc "[DEPRECATED] GitLab | Start sidekiq with launchd on Mac OS X" desc '[DEPRECATED] GitLab | Sidekiq | Start sidekiq with launchd on Mac OS X'
task :launchd do task :launchd do
deprecation_warning! deprecation_warning!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment