summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 10:34:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 10:34:06 +0000
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /lib/tasks
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
downloadgitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/benchmark.rake11
-rw-r--r--lib/tasks/brakeman.rake2
-rw-r--r--lib/tasks/cache.rake2
-rw-r--r--lib/tasks/ci/cleanup.rake2
-rw-r--r--lib/tasks/cleanup.rake2
-rw-r--r--lib/tasks/config_lint.rake2
-rw-r--r--lib/tasks/db_obsolete_ignored_columns.rake2
-rw-r--r--lib/tasks/dev.rake2
-rw-r--r--lib/tasks/downtime_check.rake2
-rw-r--r--lib/tasks/eslint.rake2
-rw-r--r--lib/tasks/file_hooks.rake2
-rw-r--r--lib/tasks/frontend.rake4
-rw-r--r--lib/tasks/gemojione.rake2
-rw-r--r--lib/tasks/gitlab/artifacts/check.rake2
-rw-r--r--lib/tasks/gitlab/artifacts/migrate.rake2
-rw-r--r--lib/tasks/gitlab/backup.rake2
-rw-r--r--lib/tasks/gitlab/bulk_add_permission.rake2
-rw-r--r--lib/tasks/gitlab/check.rake2
-rw-r--r--lib/tasks/gitlab/cleanup.rake9
-rw-r--r--lib/tasks/gitlab/container_registry.rake2
-rw-r--r--lib/tasks/gitlab/db.rake34
-rw-r--r--lib/tasks/gitlab/doctor/secrets.rake2
-rw-r--r--lib/tasks/gitlab/exclusive_lease.rake2
-rw-r--r--lib/tasks/gitlab/external_diffs.rake2
-rw-r--r--lib/tasks/gitlab/features.rake2
-rw-r--r--lib/tasks/gitlab/generate_sample_prometheus_data.rake2
-rw-r--r--lib/tasks/gitlab/git.rake2
-rw-r--r--lib/tasks/gitlab/gitaly.rake2
-rw-r--r--lib/tasks/gitlab/graphql.rake42
-rw-r--r--lib/tasks/gitlab/helpers.rake2
-rw-r--r--lib/tasks/gitlab/import.rake2
-rw-r--r--lib/tasks/gitlab/import_export.rake2
-rw-r--r--lib/tasks/gitlab/info.rake2
-rw-r--r--lib/tasks/gitlab/ldap.rake2
-rw-r--r--lib/tasks/gitlab/lfs/check.rake2
-rw-r--r--lib/tasks/gitlab/lfs/migrate.rake2
-rw-r--r--lib/tasks/gitlab/list_repos.rake2
-rw-r--r--lib/tasks/gitlab/packages/events.rake2
-rw-r--r--lib/tasks/gitlab/packages/migrate.rake2
-rw-r--r--lib/tasks/gitlab/pages.rake68
-rw-r--r--lib/tasks/gitlab/password.rake31
-rw-r--r--lib/tasks/gitlab/praefect.rake2
-rw-r--r--lib/tasks/gitlab/seed.rake2
-rw-r--r--lib/tasks/gitlab/setup.rake2
-rw-r--r--lib/tasks/gitlab/shell.rake2
-rw-r--r--lib/tasks/gitlab/snippets.rake12
-rw-r--r--lib/tasks/gitlab/storage.rake2
-rw-r--r--lib/tasks/gitlab/tcp_check.rake2
-rw-r--r--lib/tasks/gitlab/terraform/migrate.rake23
-rw-r--r--lib/tasks/gitlab/test.rake2
-rw-r--r--lib/tasks/gitlab/two_factor.rake2
-rw-r--r--lib/tasks/gitlab/update_templates.rake2
-rw-r--r--lib/tasks/gitlab/uploads/check.rake2
-rw-r--r--lib/tasks/gitlab/uploads/migrate.rake2
-rw-r--r--lib/tasks/gitlab/uploads/sanitize.rake2
-rw-r--r--lib/tasks/gitlab/usage_data.rake8
-rw-r--r--lib/tasks/gitlab/user_management.rake2
-rw-r--r--lib/tasks/gitlab/web_hook.rake2
-rw-r--r--lib/tasks/gitlab/workhorse.rake2
-rw-r--r--lib/tasks/gitlab/x509/update.rake2
-rw-r--r--lib/tasks/gitlab_danger.rake4
-rw-r--r--lib/tasks/grape.rake2
-rw-r--r--lib/tasks/haml-lint.rake2
-rw-r--r--lib/tasks/import.rake2
-rw-r--r--lib/tasks/karma.rake2
-rw-r--r--lib/tasks/lint.rake2
-rw-r--r--lib/tasks/migrate/composite_primary_keys.rake2
-rw-r--r--lib/tasks/migrate/migrate_iids.rake2
-rw-r--r--lib/tasks/migrate/setup_postgresql.rake2
-rw-r--r--lib/tasks/pngquant.rake2
-rw-r--r--lib/tasks/rubocop.rake2
-rw-r--r--lib/tasks/scss-lint.rake2
-rw-r--r--lib/tasks/setup.rake2
-rw-r--r--lib/tasks/test.rake2
-rw-r--r--lib/tasks/tokens.rake2
75 files changed, 332 insertions, 42 deletions
diff --git a/lib/tasks/benchmark.rake b/lib/tasks/benchmark.rake
new file mode 100644
index 00000000000..6deafb2c351
--- /dev/null
+++ b/lib/tasks/benchmark.rake
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+return if Rails.env.production?
+
+namespace :benchmark do
+ desc 'Benchmark | Banzai pipeline/filters'
+ RSpec::Core::RakeTask.new(:banzai) do |t|
+ t.pattern = 'spec/benchmarks/banzai_benchmark.rb'
+ ENV['BENCHMARK'] = '1'
+ end
+end
diff --git a/lib/tasks/brakeman.rake b/lib/tasks/brakeman.rake
index 2301ec9b228..44d2071751f 100644
--- a/lib/tasks/brakeman.rake
+++ b/lib/tasks/brakeman.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
desc 'Security check via brakeman'
task :brakeman do
# We get 0 warnings at level 'w3' but we would like to reach 'w2'. Merge
diff --git a/lib/tasks/cache.rake b/lib/tasks/cache.rake
index 6af91d473a6..4d698e56444 100644
--- a/lib/tasks/cache.rake
+++ b/lib/tasks/cache.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :cache do
namespace :clear do
REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000
diff --git a/lib/tasks/ci/cleanup.rake b/lib/tasks/ci/cleanup.rake
index 978a42be638..31c3928e797 100644
--- a/lib/tasks/ci/cleanup.rake
+++ b/lib/tasks/ci/cleanup.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :ci do
namespace :cleanup do
desc "GitLab | CI | Clean running builds"
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index 8574f26dbdc..c13da77217e 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :cleanup do
desc "GitLab | Cleanup | Delete moved repositories"
diff --git a/lib/tasks/config_lint.rake b/lib/tasks/config_lint.rake
index ddbcf1e1eb8..9bbefaa2d3a 100644
--- a/lib/tasks/config_lint.rake
+++ b/lib/tasks/config_lint.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ConfigLint
def self.run(files)
failures = files.reject do |file|
diff --git a/lib/tasks/db_obsolete_ignored_columns.rake b/lib/tasks/db_obsolete_ignored_columns.rake
index 00f60231f4f..cf35a355ce9 100644
--- a/lib/tasks/db_obsolete_ignored_columns.rake
+++ b/lib/tasks/db_obsolete_ignored_columns.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
desc 'Show a list of obsolete `ignored_columns`'
task 'db:obsolete_ignored_columns' => :environment do
list = Gitlab::Database::ObsoleteIgnoredColumns.new.execute
diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake
index b3ba2434855..cb01f229cd3 100644
--- a/lib/tasks/dev.rake
+++ b/lib/tasks/dev.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
task dev: ["dev:setup"]
namespace :dev do
diff --git a/lib/tasks/downtime_check.rake b/lib/tasks/downtime_check.rake
index ce97ed50fc7..3428e3f8f53 100644
--- a/lib/tasks/downtime_check.rake
+++ b/lib/tasks/downtime_check.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
desc 'Checks if migrations in a branch require downtime'
task downtime_check: :environment do
repo = if defined?(Gitlab::License)
diff --git a/lib/tasks/eslint.rake b/lib/tasks/eslint.rake
index 51f5d768102..ad63de66c81 100644
--- a/lib/tasks/eslint.rake
+++ b/lib/tasks/eslint.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
desc "GitLab | Run ESLint"
task eslint: ['yarn:check'] do
diff --git a/lib/tasks/file_hooks.rake b/lib/tasks/file_hooks.rake
index f767d63fe0d..a892d36b48e 100644
--- a/lib/tasks/file_hooks.rake
+++ b/lib/tasks/file_hooks.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :file_hooks do
desc 'Validate existing file hooks'
task validate: :environment do
diff --git a/lib/tasks/frontend.rake b/lib/tasks/frontend.rake
index 6e90229830d..b2d2c4e3f2b 100644
--- a/lib/tasks/frontend.rake
+++ b/lib/tasks/frontend.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
namespace :frontend do
desc 'GitLab | Frontend | Generate fixtures for JavaScript tests'
@@ -5,7 +7,7 @@ unless Rails.env.production?
directories = %w[spec]
directories << 'ee/spec' if Gitlab.ee?
directory_glob = "{#{directories.join(',')}}"
- args.with_defaults(pattern: "#{directory_glob}/frontend/fixtures/*.rb")
+ args.with_defaults(pattern: "#{directory_glob}/frontend/fixtures/**/*.rb")
ENV['NO_KNAPSACK'] = 'true'
t.pattern = args[:pattern]
t.rspec_opts = '--format documentation'
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake
index 85393bba9a6..a4600a0ed16 100644
--- a/lib/tasks/gemojione.rake
+++ b/lib/tasks/gemojione.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gemojione do
desc 'Generates Emoji SHA256 digests'
diff --git a/lib/tasks/gitlab/artifacts/check.rake b/lib/tasks/gitlab/artifacts/check.rake
index a105261ed51..057bb17dbda 100644
--- a/lib/tasks/gitlab/artifacts/check.rake
+++ b/lib/tasks/gitlab/artifacts/check.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :artifacts do
desc 'GitLab | Artifacts | Check integrity of uploaded job artifacts'
diff --git a/lib/tasks/gitlab/artifacts/migrate.rake b/lib/tasks/gitlab/artifacts/migrate.rake
index 871fdfb4fde..94867e1a16a 100644
--- a/lib/tasks/gitlab/artifacts/migrate.rake
+++ b/lib/tasks/gitlab/artifacts/migrate.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'logger'
require 'resolv-replace'
diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake
index de2dfca8c1b..c53ef8382b8 100644
--- a/lib/tasks/gitlab/backup.rake
+++ b/lib/tasks/gitlab/backup.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'active_record/fixtures'
namespace :gitlab do
diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake
index 56cbbae1f67..df0c6a260a2 100644
--- a/lib/tasks/gitlab/bulk_add_permission.rake
+++ b/lib/tasks/gitlab/bulk_add_permission.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :import do
desc "GitLab | Import | Add all users to all projects (admin users are added as maintainers)"
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 9e60a585330..d4e38100609 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
desc 'GitLab | Check the configuration of GitLab and its environment'
task check: :gitlab_environment do
diff --git a/lib/tasks/gitlab/cleanup.rake b/lib/tasks/gitlab/cleanup.rake
index a56a0435673..6c3a7a77e0e 100644
--- a/lib/tasks/gitlab/cleanup.rake
+++ b/lib/tasks/gitlab/cleanup.rake
@@ -56,7 +56,7 @@ namespace :gitlab do
task orphan_job_artifact_files: :gitlab_environment do
warn_user_is_not_gitlab
- cleaner = Gitlab::Cleanup::OrphanJobArtifactFiles.new(limit: limit, dry_run: dry_run?, niceness: niceness, logger: logger)
+ cleaner = Gitlab::Cleanup::OrphanJobArtifactFiles.new(dry_run: dry_run?, niceness: niceness, logger: logger)
cleaner.run!
if dry_run?
@@ -78,8 +78,7 @@ namespace :gitlab do
cleaner = Gitlab::Cleanup::OrphanLfsFileReferences.new(
project,
dry_run: dry_run?,
- logger: logger,
- limit: limit
+ logger: logger
)
cleaner.run!
@@ -162,10 +161,6 @@ namespace :gitlab do
ENV['DEBUG'].present?
end
- def limit
- ENV['LIMIT']&.to_i
- end
-
def niceness
ENV['NICENESS'].presence
end
diff --git a/lib/tasks/gitlab/container_registry.rake b/lib/tasks/gitlab/container_registry.rake
index cd18c873a5a..086f99971bc 100644
--- a/lib/tasks/gitlab/container_registry.rake
+++ b/lib/tasks/gitlab/container_registry.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :container_registry do
desc "GitLab | Container Registry | Configure"
diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake
index 901e349ea31..541a4fc62af 100644
--- a/lib/tasks/gitlab/db.rake
+++ b/lib/tasks/gitlab/db.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :db do
desc 'GitLab | DB | Manually insert schema migration version'
@@ -229,5 +231,37 @@ namespace :gitlab do
puts "Found user created projects. Database active"
exit 0
end
+
+ desc 'Run migrations with instrumentation'
+ task :migration_testing, [:result_file] => :environment do |_, args|
+ result_file = args[:result_file] || raise("Please specify result_file argument")
+ raise "File exists already, won't overwrite: #{result_file}" if File.exist?(result_file)
+
+ verbose_was, ActiveRecord::Migration.verbose = ActiveRecord::Migration.verbose, true
+
+ ctx = ActiveRecord::Base.connection.migration_context
+ existing_versions = ctx.get_all_versions.to_set
+
+ pending_migrations = ctx.migrations.reject do |migration|
+ existing_versions.include?(migration.version)
+ end
+
+ instrumentation = Gitlab::Database::Migrations::Instrumentation.new
+
+ pending_migrations.each do |migration|
+ instrumentation.observe(migration.version) do
+ ActiveRecord::Migrator.new(:up, ctx.migrations, ctx.schema_migration, migration.version).run
+ end
+ end
+ ensure
+ if instrumentation
+ File.open(result_file, 'wb+') do |io|
+ io << instrumentation.observations.to_json
+ end
+ end
+
+ ActiveRecord::Base.clear_cache!
+ ActiveRecord::Migration.verbose = verbose_was
+ end
end
end
diff --git a/lib/tasks/gitlab/doctor/secrets.rake b/lib/tasks/gitlab/doctor/secrets.rake
index 3fdef9dfc80..6e3f474312c 100644
--- a/lib/tasks/gitlab/doctor/secrets.rake
+++ b/lib/tasks/gitlab/doctor/secrets.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :doctor do
desc "GitLab | Check if the database encrypted values can be decrypted using current secrets"
diff --git a/lib/tasks/gitlab/exclusive_lease.rake b/lib/tasks/gitlab/exclusive_lease.rake
index 63b06d5251a..bee9782f373 100644
--- a/lib/tasks/gitlab/exclusive_lease.rake
+++ b/lib/tasks/gitlab/exclusive_lease.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :exclusive_lease do
desc 'GitLab | Exclusive Lease | Clear existing exclusive leases for specified scope (default: *)'
diff --git a/lib/tasks/gitlab/external_diffs.rake b/lib/tasks/gitlab/external_diffs.rake
index 08f25914007..7a5fa07aed1 100644
--- a/lib/tasks/gitlab/external_diffs.rake
+++ b/lib/tasks/gitlab/external_diffs.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :external_diffs do
desc "Override external diffs in file storage to be in object storage instead. This does not change the actual location of the data"
diff --git a/lib/tasks/gitlab/features.rake b/lib/tasks/gitlab/features.rake
index 2309aa5d214..e44328e0de1 100644
--- a/lib/tasks/gitlab/features.rake
+++ b/lib/tasks/gitlab/features.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :features do
desc 'GitLab | Features | Enable direct Git access via Rugged for NFS'
diff --git a/lib/tasks/gitlab/generate_sample_prometheus_data.rake b/lib/tasks/gitlab/generate_sample_prometheus_data.rake
index 250eaaa5568..4cd75af9d00 100644
--- a/lib/tasks/gitlab/generate_sample_prometheus_data.rake
+++ b/lib/tasks/gitlab/generate_sample_prometheus_data.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
desc "GitLab | Generate Sample Prometheus Data"
task :generate_sample_prometheus_data, [:environment_id] => :gitlab_environment do |_, args|
diff --git a/lib/tasks/gitlab/git.rake b/lib/tasks/gitlab/git.rake
index abb15f29328..9c5549b4a54 100644
--- a/lib/tasks/gitlab/git.rake
+++ b/lib/tasks/gitlab/git.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :git do
desc 'GitLab | Git | Check all repos integrity'
diff --git a/lib/tasks/gitlab/gitaly.rake b/lib/tasks/gitlab/gitaly.rake
index 49d2d3d62a2..9e474b00ba7 100644
--- a/lib/tasks/gitlab/gitaly.rake
+++ b/lib/tasks/gitlab/gitaly.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :gitaly do
desc 'GitLab | Gitaly | Install or upgrade gitaly'
diff --git a/lib/tasks/gitlab/graphql.rake b/lib/tasks/gitlab/graphql.rake
index f708114c226..e4eb4604138 100644
--- a/lib/tasks/gitlab/graphql.rake
+++ b/lib/tasks/gitlab/graphql.rake
@@ -33,7 +33,43 @@ namespace :gitlab do
)
namespace :graphql do
- desc 'Gitlab | GraphQL | Validate queries'
+ desc 'GitLab | GraphQL | Analyze queries'
+ task analyze: [:environment, :enable_feature_flags] do |t, args|
+ queries = if args.to_a.present?
+ args.to_a.flat_map { |path| Gitlab::Graphql::Queries.find(path) }
+ else
+ Gitlab::Graphql::Queries.all
+ end
+
+ queries.each do |defn|
+ $stdout.puts defn.file
+ summary, errs = defn.validate(GitlabSchema)
+
+ if summary == :client_query
+ $stdout.puts " - client query"
+ elsif errs.present?
+ $stdout.puts " - invalid query".color(:red)
+ else
+ complexity = defn.complexity(GitlabSchema)
+ color = case complexity
+ when 0..GitlabSchema::DEFAULT_MAX_COMPLEXITY
+ :green
+ when GitlabSchema::DEFAULT_MAX_COMPLEXITY..GitlabSchema::AUTHENTICATED_COMPLEXITY
+ :yellow
+ when GitlabSchema::AUTHENTICATED_COMPLEXITY..GitlabSchema::ADMIN_COMPLEXITY
+ :orange
+ else
+ :red
+ end
+
+ $stdout.puts " - complexity: #{complexity}".color(color)
+ end
+
+ $stdout.puts ""
+ end
+ end
+
+ desc 'GitLab | GraphQL | Validate queries'
task validate: [:environment, :enable_feature_flags] do |t, args|
queries = if args.to_a.present?
args.to_a.flat_map { |path| Gitlab::Graphql::Queries.find(path) }
@@ -48,10 +84,10 @@ namespace :gitlab do
when :client_query
warn("SKIP #{defn.file}: client query")
else
- warn("OK #{defn.file}") if errs.empty?
+ warn("#{'OK'.color(:green)} #{defn.file}") if errs.empty?
errs.each do |err|
warn(<<~MSG)
- ERROR #{defn.file}: #{err.message} (at #{err.path.join('.')})
+ #{'ERROR'.color(:red)} #{defn.file}: #{err.message} (at #{err.path.join('.')})
MSG
end
end
diff --git a/lib/tasks/gitlab/helpers.rake b/lib/tasks/gitlab/helpers.rake
index 14d1125a03d..b61b1833c5a 100644
--- a/lib/tasks/gitlab/helpers.rake
+++ b/lib/tasks/gitlab/helpers.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Prevent StateMachine warnings from outputting during a cron task
StateMachines::Machine.ignore_method_conflicts = true if ENV['CRON']
diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake
index 701d40b7929..bf0ba40fb31 100644
--- a/lib/tasks/gitlab/import.rake
+++ b/lib/tasks/gitlab/import.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :import do
# How to use:
diff --git a/lib/tasks/gitlab/import_export.rake b/lib/tasks/gitlab/import_export.rake
index adf696350d7..72598cdf863 100644
--- a/lib/tasks/gitlab/import_export.rake
+++ b/lib/tasks/gitlab/import_export.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :import_export do
desc 'GitLab | Import/Export | Show Import/Export version'
diff --git a/lib/tasks/gitlab/info.rake b/lib/tasks/gitlab/info.rake
index d85c8fc7949..2826002bdc2 100644
--- a/lib/tasks/gitlab/info.rake
+++ b/lib/tasks/gitlab/info.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :env do
desc 'GitLab | Env | Show information about GitLab and its environment'
diff --git a/lib/tasks/gitlab/ldap.rake b/lib/tasks/gitlab/ldap.rake
index fe7920c621f..3b2834c0008 100644
--- a/lib/tasks/gitlab/ldap.rake
+++ b/lib/tasks/gitlab/ldap.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :ldap do
desc 'GitLab | LDAP | Rename provider'
diff --git a/lib/tasks/gitlab/lfs/check.rake b/lib/tasks/gitlab/lfs/check.rake
index 869463d4e5d..582b87337ae 100644
--- a/lib/tasks/gitlab/lfs/check.rake
+++ b/lib/tasks/gitlab/lfs/check.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :lfs do
desc 'GitLab | LFS | Check integrity of uploaded LFS objects'
diff --git a/lib/tasks/gitlab/lfs/migrate.rake b/lib/tasks/gitlab/lfs/migrate.rake
index 3d4c847a0f0..05249a126bc 100644
--- a/lib/tasks/gitlab/lfs/migrate.rake
+++ b/lib/tasks/gitlab/lfs/migrate.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'logger'
desc "GitLab | LFS | Migrate LFS objects to remote storage"
diff --git a/lib/tasks/gitlab/list_repos.rake b/lib/tasks/gitlab/list_repos.rake
index b854c34a8e5..56ec94d2aef 100644
--- a/lib/tasks/gitlab/list_repos.rake
+++ b/lib/tasks/gitlab/list_repos.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
task list_repos: :environment do
scope = Project
diff --git a/lib/tasks/gitlab/packages/events.rake b/lib/tasks/gitlab/packages/events.rake
index cfe97984dda..4bf4ce430f1 100644
--- a/lib/tasks/gitlab/packages/events.rake
+++ b/lib/tasks/gitlab/packages/events.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'logger'
desc "GitLab | Packages | Events | Generate hll counter events file for packages"
diff --git a/lib/tasks/gitlab/packages/migrate.rake b/lib/tasks/gitlab/packages/migrate.rake
index cd6dcf78da3..20a8c51db66 100644
--- a/lib/tasks/gitlab/packages/migrate.rake
+++ b/lib/tasks/gitlab/packages/migrate.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'logger'
desc "GitLab | Packages | Migrate packages files to remote storage"
diff --git a/lib/tasks/gitlab/pages.rake b/lib/tasks/gitlab/pages.rake
index e15cbb4e32e..b598dab901d 100644
--- a/lib/tasks/gitlab/pages.rake
+++ b/lib/tasks/gitlab/pages.rake
@@ -1,35 +1,55 @@
+# frozen_string_literal: true
+
require 'logger'
namespace :gitlab do
namespace :pages do
desc "GitLab | Pages | Migrate legacy storage to zip format"
task migrate_legacy_storage: :gitlab_environment do
- logger = Logger.new(STDOUT)
logger.info('Starting to migrate legacy pages storage to zip deployments')
- processed_projects = 0
-
- ProjectPagesMetadatum.only_on_legacy_storage.each_batch(of: 10) do |batch|
- batch.preload(project: [:namespace, :route, pages_metadatum: :pages_deployment]).each do |metadatum|
- project = metadatum.project
-
- result = nil
- time = Benchmark.realtime do
- result = ::Pages::MigrateLegacyStorageToDeploymentService.new(project).execute
- end
- processed_projects += 1
-
- if result[:status] == :success
- logger.info("project_id: #{project.id} #{project.pages_path} has been migrated in #{time} seconds")
- else
- logger.error("project_id: #{project.id} #{project.pages_path} failed to be migrated in #{time} seconds: #{result[:message]}")
- end
- rescue => e
- logger.error("#{e.message} project_id: #{project&.id}")
- Gitlab::ErrorTracking.track_exception(e, project_id: project&.id)
- end
-
- logger.info("#{processed_projects} pages projects are processed")
+
+ result = ::Pages::MigrateFromLegacyStorageService.new(logger,
+ migration_threads: migration_threads,
+ batch_size: batch_size,
+ ignore_invalid_entries: ignore_invalid_entries).execute
+
+ logger.info("A total of #{result[:migrated] + result[:errored]} projects were processed.")
+ logger.info("- The #{result[:migrated]} projects migrated successfully")
+ logger.info("- The #{result[:errored]} projects failed to be migrated")
+ end
+
+ desc "GitLab | Pages | DANGER: Removes data which was migrated from legacy storage on zip storage. Can be used if some bugs in migration are discovered and migration needs to be restarted from scratch."
+ task clean_migrated_zip_storage: :gitlab_environment do
+ destroyed_deployments = 0
+
+ logger.info("Starting to delete migrated pages deployments")
+
+ ::PagesDeployment.migrated_from_legacy_storage.each_batch(of: batch_size) do |batch|
+ destroyed_deployments += batch.count
+
+ # we need to destroy associated files, so can't use delete_all
+ batch.destroy_all # rubocop: disable Cop/DestroyAll
+
+ logger.info("#{destroyed_deployments} deployments were deleted")
end
end
+
+ def logger
+ @logger ||= Logger.new(STDOUT)
+ end
+
+ def migration_threads
+ ENV.fetch('PAGES_MIGRATION_THREADS', '3').to_i
+ end
+
+ def batch_size
+ ENV.fetch('PAGES_MIGRATION_BATCH_SIZE', '10').to_i
+ end
+
+ def ignore_invalid_entries
+ Gitlab::Utils.to_boolean(
+ ENV.fetch('PAGES_MIGRATION_IGNORE_INVALID_ENTRIES', 'false')
+ )
+ end
end
end
diff --git a/lib/tasks/gitlab/password.rake b/lib/tasks/gitlab/password.rake
new file mode 100644
index 00000000000..02c28578a2a
--- /dev/null
+++ b/lib/tasks/gitlab/password.rake
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+namespace :gitlab do
+ namespace :password do
+ desc "GitLab | Password | Reset a user's password"
+ task :reset, [:username] => :environment do |_, args|
+ username = args[:username] || Gitlab::TaskHelpers.prompt('Enter username: ')
+ abort('Username can not be empty.') if username.blank?
+
+ user = User.find_by(username: username)
+ abort("Unable to find user with username #{username}.") unless user
+
+ password = Gitlab::TaskHelpers.prompt_for_password
+ password_confirm = Gitlab::TaskHelpers.prompt_for_password('Confirm password: ')
+
+ user.password = password
+ user.password_confirmation = password_confirm
+ user.send_only_admin_changed_your_password_notification!
+
+ unless user.save
+ message = <<~EOF
+ Unable to change password of the user with username #{username}.
+ #{user.errors.full_messages.to_sentence}
+ EOF
+
+ abort(message)
+ end
+
+ puts "Password successfully updated for user with username #{username}."
+ end
+ end
+end
diff --git a/lib/tasks/gitlab/praefect.rake b/lib/tasks/gitlab/praefect.rake
index a9b126ae379..346df3e0c75 100644
--- a/lib/tasks/gitlab/praefect.rake
+++ b/lib/tasks/gitlab/praefect.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :praefect do
def int?(string)
diff --git a/lib/tasks/gitlab/seed.rake b/lib/tasks/gitlab/seed.rake
index d758280ba69..36761165af5 100644
--- a/lib/tasks/gitlab/seed.rake
+++ b/lib/tasks/gitlab/seed.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :seed do
desc "GitLab | Seed | Seeds issues"
diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake
index 50774de77c9..31bd80e78d4 100644
--- a/lib/tasks/gitlab/setup.rake
+++ b/lib/tasks/gitlab/setup.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
desc "GitLab | Setup production application"
task setup: :gitlab_environment do
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index edbaec85bd9..b3abc48f8e0 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :shell do
desc "GitLab | Shell | Install or upgrade gitlab-shell"
diff --git a/lib/tasks/gitlab/snippets.rake b/lib/tasks/gitlab/snippets.rake
index ed2e88692d5..b55f82480e1 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 == 0
+ raise "Invalid limit value" if snippet_task_limit == 0
if migration_running?
raise "There are already snippet migrations running. Please wait until they are finished."
@@ -41,8 +41,8 @@ namespace :gitlab do
end
end
- if ids.size > limit
- raise "The number of ids provided is higher than #{limit}. You can update this limit by using the env var `LIMIT`"
+ if ids.size > snippet_task_limit
+ raise "The number of ids provided is higher than #{snippet_task_limit}. You can update this limit by using the env var `LIMIT`"
end
ids
@@ -68,14 +68,14 @@ 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 == 0
+ raise "Invalid limit value" if snippet_task_limit == 0
non_migrated_count = non_migrated_snippets.count
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"
- puts non_migrated_snippets.limit(limit).pluck(:id).join(',')
+ puts non_migrated_snippets.limit(snippet_task_limit).pluck(:id).join(',')
end
end
@@ -84,7 +84,7 @@ namespace :gitlab do
end
# There are problems with the specs if we memoize this value
- def limit
+ def snippet_task_limit
ENV['LIMIT'] ? ENV['LIMIT'].to_i : DEFAULT_LIMIT
end
end
diff --git a/lib/tasks/gitlab/storage.rake b/lib/tasks/gitlab/storage.rake
index f7819fd974b..ede6b6af80b 100644
--- a/lib/tasks/gitlab/storage.rake
+++ b/lib/tasks/gitlab/storage.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :storage do
desc 'GitLab | Storage | Migrate existing projects to Hashed Storage'
diff --git a/lib/tasks/gitlab/tcp_check.rake b/lib/tasks/gitlab/tcp_check.rake
index 1400f57d6b9..4790d86832d 100644
--- a/lib/tasks/gitlab/tcp_check.rake
+++ b/lib/tasks/gitlab/tcp_check.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
desc "GitLab | Check TCP connectivity to a specific host and port"
task :tcp_check, [:host, :port] => :environment do |_t, args|
diff --git a/lib/tasks/gitlab/terraform/migrate.rake b/lib/tasks/gitlab/terraform/migrate.rake
new file mode 100644
index 00000000000..a9c16049240
--- /dev/null
+++ b/lib/tasks/gitlab/terraform/migrate.rake
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'logger'
+
+desc "GitLab | Terraform | Migrate Terraform states to remote storage"
+namespace :gitlab do
+ namespace :terraform_states do
+ task migrate: :environment do
+ logger = Logger.new(STDOUT)
+ logger.info('Starting transfer of Terraform states to object storage')
+
+ begin
+ Gitlab::Terraform::StateMigrationHelper.migrate_to_remote_storage do |state_version|
+ message = "Transferred Terraform state version ID #{state_version.id} (#{state_version.terraform_state.name}/#{state_version.version}) to object storage"
+
+ logger.info(message)
+ end
+ rescue => e
+ logger.error("Failed to migrate: #{e.message}")
+ end
+ end
+ end
+end
diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake
index 2222807fe13..a83ba69bc75 100644
--- a/lib/tasks/gitlab/test.rake
+++ b/lib/tasks/gitlab/test.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
desc "GitLab | Run all tests"
task :test do
diff --git a/lib/tasks/gitlab/two_factor.rake b/lib/tasks/gitlab/two_factor.rake
index 6a9e87e1541..9d10976fbce 100644
--- a/lib/tasks/gitlab/two_factor.rake
+++ b/lib/tasks/gitlab/two_factor.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :two_factor do
desc "GitLab | 2FA | Disable Two-factor authentication (2FA) for all users"
diff --git a/lib/tasks/gitlab/update_templates.rake b/lib/tasks/gitlab/update_templates.rake
index fdcd34320b1..e3a4e7f50b8 100644
--- a/lib/tasks/gitlab/update_templates.rake
+++ b/lib/tasks/gitlab/update_templates.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
desc "GitLab | Update templates"
task :update_templates do
diff --git a/lib/tasks/gitlab/uploads/check.rake b/lib/tasks/gitlab/uploads/check.rake
index 2be2ec7f9c9..8ccc84d15f4 100644
--- a/lib/tasks/gitlab/uploads/check.rake
+++ b/lib/tasks/gitlab/uploads/check.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :uploads do
desc 'GitLab | Uploads | Check integrity of uploaded files'
diff --git a/lib/tasks/gitlab/uploads/migrate.rake b/lib/tasks/gitlab/uploads/migrate.rake
index 879b07da1df..6052ff90341 100644
--- a/lib/tasks/gitlab/uploads/migrate.rake
+++ b/lib/tasks/gitlab/uploads/migrate.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :uploads do
namespace :migrate do
diff --git a/lib/tasks/gitlab/uploads/sanitize.rake b/lib/tasks/gitlab/uploads/sanitize.rake
index 4f23a0a5d82..eec423cbb8b 100644
--- a/lib/tasks/gitlab/uploads/sanitize.rake
+++ b/lib/tasks/gitlab/uploads/sanitize.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :uploads do
namespace :sanitize do
diff --git a/lib/tasks/gitlab/usage_data.rake b/lib/tasks/gitlab/usage_data.rake
index d6f5661d5eb..95072444fcf 100644
--- a/lib/tasks/gitlab/usage_data.rake
+++ b/lib/tasks/gitlab/usage_data.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :usage_data do
desc 'GitLab | UsageData | Generate raw SQLs for usage ping in YAML'
@@ -21,5 +23,11 @@ namespace :gitlab do
puts Gitlab::Json.pretty_generate(result.attributes)
end
+
+ desc 'GitLab | UsageData | Generate metrics dictionary'
+ task generate_metrics_dictionary: :environment do
+ items = Gitlab::Usage::MetricDefinition.definitions
+ Gitlab::Usage::Docs::Renderer.new(items).write
+ end
end
end
diff --git a/lib/tasks/gitlab/user_management.rake b/lib/tasks/gitlab/user_management.rake
index f47e549e795..29f2360f64a 100644
--- a/lib/tasks/gitlab/user_management.rake
+++ b/lib/tasks/gitlab/user_management.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :user_management do
desc "GitLab | User management | Update all users of a group with personal project limit to 0 and can_create_group to false"
diff --git a/lib/tasks/gitlab/web_hook.rake b/lib/tasks/gitlab/web_hook.rake
index b242329d720..091743485c9 100644
--- a/lib/tasks/gitlab/web_hook.rake
+++ b/lib/tasks/gitlab/web_hook.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :web_hook do
desc "GitLab | Webhook | Adds a webhook to the projects"
diff --git a/lib/tasks/gitlab/workhorse.rake b/lib/tasks/gitlab/workhorse.rake
index 2d72a01f66f..0d9f8efa64f 100644
--- a/lib/tasks/gitlab/workhorse.rake
+++ b/lib/tasks/gitlab/workhorse.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :workhorse do
desc "GitLab | Workhorse | Install or upgrade gitlab-workhorse"
diff --git a/lib/tasks/gitlab/x509/update.rake b/lib/tasks/gitlab/x509/update.rake
index eaba9196acf..de878a3d093 100644
--- a/lib/tasks/gitlab/x509/update.rake
+++ b/lib/tasks/gitlab/x509/update.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'logger'
desc "GitLab | X509 | Update signatures when certificate store has changed"
diff --git a/lib/tasks/gitlab_danger.rake b/lib/tasks/gitlab_danger.rake
index e75539f048c..5df4a8ce4f1 100644
--- a/lib/tasks/gitlab_danger.rake
+++ b/lib/tasks/gitlab_danger.rake
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
+
desc 'Run local Danger rules'
task :danger_local do
- require 'gitlab_danger'
+ require_relative '../../tooling/gitlab_danger'
require 'gitlab/popen'
puts("#{GitlabDanger.local_warning_message}\n")
diff --git a/lib/tasks/grape.rake b/lib/tasks/grape.rake
index ea2698da606..c72403a375a 100644
--- a/lib/tasks/grape.rake
+++ b/lib/tasks/grape.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :grape do
desc 'Print compiled grape routes'
task routes: :environment do
diff --git a/lib/tasks/haml-lint.rake b/lib/tasks/haml-lint.rake
index 305e15d69d5..270793359e1 100644
--- a/lib/tasks/haml-lint.rake
+++ b/lib/tasks/haml-lint.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
require 'haml_lint/rake_task'
require Rails.root.join('haml_lint/inline_javascript')
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 500891df43d..633beb132d8 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'benchmark'
require 'rainbow/ext/string'
diff --git a/lib/tasks/karma.rake b/lib/tasks/karma.rake
index 36590010406..fa3f8805159 100644
--- a/lib/tasks/karma.rake
+++ b/lib/tasks/karma.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
namespace :karma do
# alias exists for legacy reasons
diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake
index 7a4d09bb6d4..5d60bc41f21 100644
--- a/lib/tasks/lint.rake
+++ b/lib/tasks/lint.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
namespace :lint do
task :static_verification_env do
diff --git a/lib/tasks/migrate/composite_primary_keys.rake b/lib/tasks/migrate/composite_primary_keys.rake
index 732dedf4d4f..68f7c4d6c4a 100644
--- a/lib/tasks/migrate/composite_primary_keys.rake
+++ b/lib/tasks/migrate/composite_primary_keys.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
namespace :gitlab do
namespace :db do
desc 'GitLab | DB | Adds primary keys to tables that only have composite unique keys'
diff --git a/lib/tasks/migrate/migrate_iids.rake b/lib/tasks/migrate/migrate_iids.rake
index cb7c496c31c..e0666a87656 100644
--- a/lib/tasks/migrate/migrate_iids.rake
+++ b/lib/tasks/migrate/migrate_iids.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
desc "GitLab | Build internal ids for issues and merge requests"
task migrate_iids: :environment do
puts 'Issues'.color(:yellow)
diff --git a/lib/tasks/migrate/setup_postgresql.rake b/lib/tasks/migrate/setup_postgresql.rake
index 4c8f13b63a4..27dd9e842ff 100644
--- a/lib/tasks/migrate/setup_postgresql.rake
+++ b/lib/tasks/migrate/setup_postgresql.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
desc 'GitLab | Generate PostgreSQL Password Hash'
task :postgresql_md5_hash do
require 'digest'
diff --git a/lib/tasks/pngquant.rake b/lib/tasks/pngquant.rake
index 63bc1c7c16e..45c0288cadf 100644
--- a/lib/tasks/pngquant.rake
+++ b/lib/tasks/pngquant.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
return if Rails.env.production?
require 'png_quantizator'
diff --git a/lib/tasks/rubocop.rake b/lib/tasks/rubocop.rake
index 78ffccc9d06..f5d16835347 100644
--- a/lib/tasks/rubocop.rake
+++ b/lib/tasks/rubocop.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
require 'rubocop/rake_task'
diff --git a/lib/tasks/scss-lint.rake b/lib/tasks/scss-lint.rake
index 250fd8699e4..8a4809f80fd 100644
--- a/lib/tasks/scss-lint.rake
+++ b/lib/tasks/scss-lint.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
unless Rails.env.production?
require 'scss_lint/rake_task'
diff --git a/lib/tasks/setup.rake b/lib/tasks/setup.rake
index 4c79ffbfa6b..bae22f9a590 100644
--- a/lib/tasks/setup.rake
+++ b/lib/tasks/setup.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
desc "GitLab | Setup gitlab db"
task :setup do
Rake::Task["gitlab:setup"].invoke
diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake
index b52af81fc16..b24817468c6 100644
--- a/lib/tasks/test.rake
+++ b/lib/tasks/test.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rake::Task["test"].clear
desc "GitLab | Run all tests"
diff --git a/lib/tasks/tokens.rake b/lib/tasks/tokens.rake
index 46635cd7c8f..b0ff2cce482 100644
--- a/lib/tasks/tokens.rake
+++ b/lib/tasks/tokens.rake
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative '../../app/models/concerns/token_authenticatable.rb'
require_relative '../../app/models/concerns/token_authenticatable_strategies/base.rb'
require_relative '../../app/models/concerns/token_authenticatable_strategies/insecure.rb'