diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /lib/tasks | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gettext.rake | 12 | ||||
-rw-r--r-- | lib/tasks/gitlab/backup.rake | 11 | ||||
-rw-r--r-- | lib/tasks/gitlab/gitaly.rake | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/snippets.rake | 8 | ||||
-rw-r--r-- | lib/tasks/gitlab/workhorse.rake | 2 |
5 files changed, 26 insertions, 9 deletions
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake index a192293fae6..31030d061f2 100644 --- a/lib/tasks/gettext.rake +++ b/lib/tasks/gettext.rake @@ -12,6 +12,14 @@ namespace :gettext do ) end + # Disallow HTML from translatable strings + # See: https://docs.gitlab.com/ee/development/i18n/externalization.html#html + def html_todolist + return @html_todolist if defined?(@html_todolist) + + @html_todolist = YAML.load_file(Rails.root.join('lib/gitlab/i18n/html_todo.yml')) + end + task :compile do # See: https://gitlab.com/gitlab-org/gitlab-foss/issues/33014#note_31218998 FileUtils.touch(File.join(Rails.root, 'locale/gitlab.pot')) @@ -54,11 +62,11 @@ namespace :gettext do linters = files.map do |file| locale = File.basename(File.dirname(file)) - Gitlab::I18n::PoLinter.new(file, locale) + Gitlab::I18n::PoLinter.new(po_path: file, html_todolist: html_todolist, locale: locale) end pot_file = Rails.root.join('locale/gitlab.pot') - linters.unshift(Gitlab::I18n::PoLinter.new(pot_file)) + linters.unshift(Gitlab::I18n::PoLinter.new(po_path: pot_file, html_todolist: html_todolist)) failed_linters = linters.select { |linter| linter.errors.any? } diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index e5e2faaa7df..b0f1ca39387 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -93,10 +93,19 @@ namespace :gitlab do task create: :gitlab_environment do puts_time "Dumping repositories ...".color(:blue) + max_concurrency = ENV.fetch('GITLAB_BACKUP_MAX_CONCURRENCY', 1).to_i + max_storage_concurrency = ENV.fetch('GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY', 1).to_i + if ENV["SKIP"] && ENV["SKIP"].include?("repositories") puts_time "[SKIPPED]".color(:cyan) + elsif max_concurrency < 1 || max_storage_concurrency < 1 + puts "GITLAB_BACKUP_MAX_CONCURRENCY and GITLAB_BACKUP_MAX_STORAGE_CONCURRENCY must have a value of at least 1".color(:red) + exit 1 else - Backup::Repository.new(progress).dump + Backup::Repository.new(progress).dump( + max_concurrency: max_concurrency, + max_storage_concurrency: max_storage_concurrency + ) puts_time "done".color(:green) end end diff --git a/lib/tasks/gitlab/gitaly.rake b/lib/tasks/gitlab/gitaly.rake index fc55d9704d1..74cf3aad951 100644 --- a/lib/tasks/gitlab/gitaly.rake +++ b/lib/tasks/gitlab/gitaly.rake @@ -17,7 +17,7 @@ Usage: rake "gitlab:gitaly:install[/installation/dir,/storage/path]") command = [] _, status = Gitlab::Popen.popen(%w[which gmake]) - command << (status.zero? ? 'gmake' : 'make') + command << (status == 0 ? 'gmake' : 'make') if Rails.env.test? command.push( diff --git a/lib/tasks/gitlab/snippets.rake b/lib/tasks/gitlab/snippets.rake index c391cecfdbc..ed2e88692d5 100644 --- a/lib/tasks/gitlab/snippets.rake +++ b/lib/tasks/gitlab/snippets.rake @@ -13,7 +13,7 @@ namespace :gitlab do raise "Please supply the list of ids through the SNIPPET_IDS env var" end - raise "Invalid limit value" if limit.zero? + raise "Invalid limit value" if limit == 0 if migration_running? raise "There are already snippet migrations running. Please wait until they are finished." @@ -37,7 +37,7 @@ namespace :gitlab do def parse_snippet_ids! ids = ENV['SNIPPET_IDS'].delete(' ').split(',').map do |id| id.to_i.tap do |value| - raise "Invalid id provided" if value.zero? + raise "Invalid id provided" if value == 0 end end @@ -68,10 +68,10 @@ namespace :gitlab do # bundle exec rake gitlab:snippets:list_non_migrated LIMIT=50 desc 'GitLab | Show non migrated snippets' task list_non_migrated: :environment do - raise "Invalid limit value" if limit.zero? + raise "Invalid limit value" if limit == 0 non_migrated_count = non_migrated_snippets.count - if non_migrated_count.zero? + if non_migrated_count == 0 puts "All snippets have been successfully migrated" else puts "There are #{non_migrated_count} snippets that haven't been migrated. Showing a batch of ids of those snippets:\n" diff --git a/lib/tasks/gitlab/workhorse.rake b/lib/tasks/gitlab/workhorse.rake index 53343c8f8ff..15084a118b7 100644 --- a/lib/tasks/gitlab/workhorse.rake +++ b/lib/tasks/gitlab/workhorse.rake @@ -15,7 +15,7 @@ namespace :gitlab do checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir, clone_opts: %w[--depth 1]) _, status = Gitlab::Popen.popen(%w[which gmake]) - command = status.zero? ? 'gmake' : 'make' + command = status == 0 ? 'gmake' : 'make' Dir.chdir(args.dir) do run_command!([command]) |