diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /lib/tasks/gitlab | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'lib/tasks/gitlab')
-rw-r--r-- | lib/tasks/gitlab/assets.rake | 6 | ||||
-rw-r--r-- | lib/tasks/gitlab/backup.rake | 27 | ||||
-rw-r--r-- | lib/tasks/gitlab/db.rake | 7 | ||||
-rw-r--r-- | lib/tasks/gitlab/lfs/migrate.rake | 10 | ||||
-rw-r--r-- | lib/tasks/gitlab/sidekiq.rake | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/usage_data.rake | 13 |
6 files changed, 56 insertions, 9 deletions
diff --git a/lib/tasks/gitlab/assets.rake b/lib/tasks/gitlab/assets.rake index 69a3526b872..caa583fb3a9 100644 --- a/lib/tasks/gitlab/assets.rake +++ b/lib/tasks/gitlab/assets.rake @@ -55,6 +55,7 @@ namespace :gitlab do rake:assets:precompile gitlab:assets:compile_webpack_if_needed gitlab:assets:fix_urls + gitlab:assets:check_page_bundle_mixins_css_for_sideeffects ].each(&::Gitlab::TaskHelpers.method(:invoke_and_time_task)) end @@ -127,5 +128,10 @@ namespace :gitlab do abort 'Error: Unable to compile webpack DLL.'.color(:red) end end + + desc 'GitLab | Assets | Check that scss mixins do not introduce any sideffects' + task :check_page_bundle_mixins_css_for_sideeffects do + system('./scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js') + end end end diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index b0f1ca39387..2a3713ed85c 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -47,6 +47,11 @@ namespace :gitlab do begin unless ENV['force'] == 'yes' warning = <<-MSG.strip_heredoc + Be sure to stop Puma, Sidekiq, and any other process that + connects to the database before proceeding. For Omnibus + installs, see the following link for more information: + https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations + Before restoring the database, we will remove all existing tables to avoid future upgrade problems. Be aware that if you have custom tables in the GitLab database these tables and all data will be @@ -131,7 +136,21 @@ namespace :gitlab do task restore: :gitlab_environment do puts_time "Restoring database ... ".color(:blue) - Backup::Database.new(progress).restore + errors = Backup::Database.new(progress).restore + + if errors.present? + warning = <<~MSG + There were errors in restoring the schema. This may cause + issues if this results in missing indexes, constraints, or + columns. Please record the errors above and contact GitLab + Support if you have questions: + https://about.gitlab.com/support/ + MSG + + warn warning.color(:red) + ask_to_continue + end + puts_time "done".color(:green) end end @@ -273,5 +292,7 @@ namespace :gitlab do $stdout end end - end # namespace end: backup -end # namespace end: gitlab + end + # namespace end: backup +end +# namespace end: gitlab diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 61318570fd5..425f66918b0 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -166,5 +166,12 @@ namespace :gitlab do Rake::Task['db:test:load'].enhance do Rake::Task['gitlab:db:create_dynamic_partitions'].invoke end + + desc 'reindex a regular (non-unique) index without downtime to eliminate bloat' + task :reindex, [:index_name] => :environment do |_, args| + raise ArgumentError, 'must give the index name to reindex' unless args[:index_name] + + Gitlab::Database::ConcurrentReindex.new(args[:index_name], logger: Logger.new(STDOUT)).execute + end end end diff --git a/lib/tasks/gitlab/lfs/migrate.rake b/lib/tasks/gitlab/lfs/migrate.rake index 470a12c39cd..3d4c847a0f0 100644 --- a/lib/tasks/gitlab/lfs/migrate.rake +++ b/lib/tasks/gitlab/lfs/migrate.rake @@ -9,12 +9,12 @@ namespace :gitlab do LfsObject.with_files_stored_locally .find_each(batch_size: 10) do |lfs_object| - lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE) + lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE) - logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage") - rescue => e - logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}") - end + logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage") + rescue => e + logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}") + end end task migrate_to_local: :environment do diff --git a/lib/tasks/gitlab/sidekiq.rake b/lib/tasks/gitlab/sidekiq.rake index eb3de195626..6f00db42d78 100644 --- a/lib/tasks/gitlab/sidekiq.rake +++ b/lib/tasks/gitlab/sidekiq.rake @@ -5,7 +5,7 @@ return if Rails.env.production? namespace :gitlab do namespace :sidekiq do def write_yaml(path, banner, object) - File.write(path, banner + YAML.dump(object)) + File.write(path, banner + YAML.dump(object).gsub(/ *$/m, '')) end namespace :all_queues_yml do diff --git a/lib/tasks/gitlab/usage_data.rake b/lib/tasks/gitlab/usage_data.rake new file mode 100644 index 00000000000..6f3db91c2b0 --- /dev/null +++ b/lib/tasks/gitlab/usage_data.rake @@ -0,0 +1,13 @@ +namespace :gitlab do + namespace :usage_data do + desc 'GitLab | UsageData | Generate raw SQLs for usage ping in YAML' + task dump_sql_in_yaml: :environment do + puts Gitlab::UsageDataQueries.uncached_data.to_yaml + end + + desc 'GitLab | UsageData | Generate raw SQLs for usage ping in JSON' + task dump_sql_in_json: :environment do + puts Gitlab::Json.pretty_generate(Gitlab::UsageDataQueries.uncached_data) + end + end +end |