Skip to content
Snippets Groups Projects
Commit 87c9df29 authored by Douwe Maan's avatar Douwe Maan
Browse files

Don’t exclude some file in lib from rubocop

parent e2bbbb1a
No related branches found
No related tags found
No related merge requests found
Showing
with 131 additions and 129 deletions
Loading
Loading
@@ -22,13 +22,6 @@ AllCops:
- 'db/fixtures/**/*'
- 'tmp/**/*'
- 'bin/**/*'
- 'lib/backup/**/*'
- 'lib/ci/backup/**/*'
- 'lib/tasks/**/*'
- 'lib/ci/migrate/**/*'
- 'lib/email_validator.rb'
- 'lib/gitlab/upgrader.rb'
- 'lib/gitlab/seeder.rb'
- 'generator_templates/**/*'
 
# Style #######################################################################
Loading
Loading
@@ -208,6 +201,9 @@ Style/FrozenStringLiteralComment:
# Do not introduce global variables.
Style/GlobalVars:
Enabled: true
Exclude:
- 'lib/backup/**/*'
- 'lib/tasks/**/*'
 
# Prefer Ruby 1.9 hash syntax `{ a: 1, b: 2 }`
# over 1.8 syntax `{ :a => 1, :b => 2 }`.
Loading
Loading
@@ -780,6 +776,11 @@ Rails/HasAndBelongsToMany:
# Checks for calls to puts, print, etc.
Rails/Output:
Enabled: true
Exclude:
- lib/gitlab/seeder.rb
- lib/gitlab/upgrader.rb
- 'lib/backup/**/*'
- 'lib/tasks/**/*'
 
# Checks for incorrect grammar when using methods like `3.day.ago`.
Rails/PluralizationGrammar:
Loading
Loading
@@ -971,3 +972,9 @@ Style/ConditionalAssignment:
 
Style/DoubleNegation:
Enabled: false
Rails/Exit:
Enabled: true
Exclude:
- lib/gitlab/upgrader.rb
- 'lib/backup/**/*'
Loading
Loading
@@ -5,7 +5,7 @@ module Backup
attr_reader :config, :db_file_name
 
def initialize
@config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
@config = YAML.load_file(File.join(Rails.root, 'config', 'database.yml'))[Rails.env]
@db_file_name = File.join(Gitlab.config.backup.path, 'db', 'database.sql.gz')
end
 
Loading
Loading
@@ -13,28 +13,32 @@ module Backup
FileUtils.mkdir_p(File.dirname(db_file_name))
FileUtils.rm_f(db_file_name)
compress_rd, compress_wr = IO.pipe
compress_pid = spawn(*%W(gzip -1 -c), in: compress_rd, out: [db_file_name, 'w', 0600])
compress_pid = spawn(*%w(gzip -1 -c), in: compress_rd, out: [db_file_name, 'w', 0600])
compress_rd.close
 
dump_pid = case config["adapter"]
when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... "
# Workaround warnings from MySQL 5.6 about passwords on cmd line
ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
spawn('mysqldump', *mysql_args, config['database'], out: compress_wr)
when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... "
pg_env
pgsql_args = ["--clean"] # Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
if Gitlab.config.backup.pg_schema
pgsql_args << "-n"
pgsql_args << Gitlab.config.backup.pg_schema
dump_pid =
case config["adapter"]
when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... "
# Workaround warnings from MySQL 5.6 about passwords on cmd line
ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
spawn('mysqldump', *mysql_args, config['database'], out: compress_wr)
when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... "
pg_env
pgsql_args = ["--clean"] # Pass '--clean' to include 'DROP TABLE' statements in the DB dump.
if Gitlab.config.backup.pg_schema
pgsql_args << "-n"
pgsql_args << Gitlab.config.backup.pg_schema
end
spawn('pg_dump', *pgsql_args, config['database'], out: compress_wr)
end
spawn('pg_dump', *pgsql_args, config['database'], out: compress_wr)
end
compress_wr.close
 
success = [compress_pid, dump_pid].all? { |pid| Process.waitpid(pid); $?.success? }
success = [compress_pid, dump_pid].all? do |pid|
Process.waitpid(pid)
$?.success?
end
 
report_success(success)
abort 'Backup failed' unless success
Loading
Loading
@@ -42,23 +46,27 @@ module Backup
 
def restore
decompress_rd, decompress_wr = IO.pipe
decompress_pid = spawn(*%W(gzip -cd), out: decompress_wr, in: db_file_name)
decompress_pid = spawn(*%w(gzip -cd), out: decompress_wr, in: db_file_name)
decompress_wr.close
 
restore_pid = case config["adapter"]
when /^mysql/ then
$progress.print "Restoring MySQL database #{config['database']} ... "
# Workaround warnings from MySQL 5.6 about passwords on cmd line
ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
spawn('mysql', *mysql_args, config['database'], in: decompress_rd)
when "postgresql" then
$progress.print "Restoring PostgreSQL database #{config['database']} ... "
pg_env
spawn('psql', config['database'], in: decompress_rd)
end
restore_pid =
case config["adapter"]
when /^mysql/ then
$progress.print "Restoring MySQL database #{config['database']} ... "
# Workaround warnings from MySQL 5.6 about passwords on cmd line
ENV['MYSQL_PWD'] = config["password"].to_s if config["password"]
spawn('mysql', *mysql_args, config['database'], in: decompress_rd)
when "postgresql" then
$progress.print "Restoring PostgreSQL database #{config['database']} ... "
pg_env
spawn('psql', config['database'], in: decompress_rd)
end
decompress_rd.close
 
success = [decompress_pid, restore_pid].all? { |pid| Process.waitpid(pid); $?.success? }
success = [decompress_pid, restore_pid].all? do |pid|
Process.waitpid(pid)
$?.success?
end
 
report_success(success)
abort 'Restore failed' unless success
Loading
Loading
Loading
Loading
@@ -26,10 +26,10 @@ module Backup
abort 'Backup failed'
end
 
run_pipeline!([%W(tar -C #{@backup_files_dir} -cf - .), %W(gzip -c -1)], out: [backup_tarball, 'w', 0600])
run_pipeline!([%W(tar -C #{@backup_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600])
FileUtils.rm_rf(@backup_files_dir)
else
run_pipeline!([%W(tar -C #{app_files_dir} -cf - .), %W(gzip -c -1)], out: [backup_tarball, 'w', 0600])
run_pipeline!([%W(tar -C #{app_files_dir} -cf - .), %w(gzip -c -1)], out: [backup_tarball, 'w', 0600])
end
end
 
Loading
Loading
@@ -37,7 +37,7 @@ module Backup
backup_existing_files_dir
create_files_dir
 
run_pipeline!([%W(gzip -cd), %W(tar -C #{app_files_dir} -xf -)], in: backup_tarball)
run_pipeline!([%w(gzip -cd), %W(tar -C #{app_files_dir} -xf -)], in: backup_tarball)
end
 
def backup_existing_files_dir
Loading
Loading
@@ -47,7 +47,7 @@ module Backup
end
end
 
def run_pipeline!(cmd_list, options={})
def run_pipeline!(cmd_list, options = {})
status_list = Open3.pipeline(*cmd_list, options)
abort 'Backup failed' unless status_list.compact.all?(&:success?)
end
Loading
Loading
module Backup
class Manager
ARCHIVES_TO_BACKUP = %w[uploads builds artifacts pages lfs registry]
FOLDERS_TO_BACKUP = %w[repositories db]
FILE_NAME_SUFFIX = '_gitlab_backup.tar'
ARCHIVES_TO_BACKUP = %w[uploads builds artifacts pages lfs registry].freeze
FOLDERS_TO_BACKUP = %w[repositories db].freeze
FILE_NAME_SUFFIX = '_gitlab_backup.tar'.freeze
 
def pack
# Make sure there is a connection
Loading
Loading
@@ -20,13 +20,13 @@ module Backup
Dir.chdir(Gitlab.config.backup.path) do
File.open("#{Gitlab.config.backup.path}/backup_information.yml",
"w+") do |file|
file << s.to_yaml.gsub(/^---\n/,'')
file << s.to_yaml.gsub(/^---\n/, '')
end
 
# create archive
$progress.print "Creating backup archive: #{tar_file} ... "
# Set file permissions on open to prevent chmod races.
tar_system_options = {out: [tar_file, 'w', Gitlab.config.backup.archive_permissions]}
tar_system_options = { out: [tar_file, 'w', Gitlab.config.backup.archive_permissions] }
if Kernel.system('tar', '-cf', '-', *backup_contents, tar_system_options)
$progress.puts "done".color(:green)
else
Loading
Loading
@@ -50,8 +50,8 @@ module Backup
directory = connect_to_remote_directory(connection_settings)
 
if directory.files.create(key: tar_file, body: File.open(tar_file), public: false,
multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
encryption: Gitlab.config.backup.upload.encryption)
multipart_chunk_size: Gitlab.config.backup.upload.multipart_chunk_size,
encryption: Gitlab.config.backup.upload.encryption)
$progress.puts "done".color(:green)
else
puts "uploading backup to #{remote_directory} failed".color(:red)
Loading
Loading
@@ -123,11 +123,11 @@ module Backup
exit 1
end
 
if ENV['BACKUP'].present?
tar_file = "#{ENV['BACKUP']}#{FILE_NAME_SUFFIX}"
else
tar_file = file_list.first
end
tar_file = if ENV['BACKUP'].present?
"#{ENV['BACKUP']}#{FILE_NAME_SUFFIX}"
else
file_list.first
end
 
unless File.exist?(tar_file)
$progress.puts "The backup file #{tar_file} does not exist!"
Loading
Loading
@@ -158,7 +158,7 @@ module Backup
end
 
def tar_version
tar_version, _ = Gitlab::Popen.popen(%W(tar --version))
tar_version, _ = Gitlab::Popen.popen(%w(tar --version))
tar_version.force_encoding('locale').split("\n").first
end
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ require 'yaml'
 
module Backup
class Repository
# rubocop:disable Metrics/AbcSize
def dump
prepare
 
Loading
Loading
@@ -85,11 +85,11 @@ module Backup
 
project.ensure_dir_exist
 
if File.exists?(path_to_project_bundle)
cmd = %W(#{Gitlab.config.git.bin_path} clone --bare #{path_to_project_bundle} #{path_to_project_repo})
else
cmd = %W(#{Gitlab.config.git.bin_path} init --bare #{path_to_project_repo})
end
cmd = if File.exist?(path_to_project_bundle)
%W(#{Gitlab.config.git.bin_path} clone --bare #{path_to_project_bundle} #{path_to_project_repo})
else
%W(#{Gitlab.config.git.bin_path} init --bare #{path_to_project_repo})
end
 
output, status = Gitlab::Popen.popen(cmd)
if status.zero?
Loading
Loading
@@ -150,6 +150,7 @@ module Backup
puts output
end
end
# rubocop:enable Metrics/AbcSize
 
protected
 
Loading
Loading
@@ -193,7 +194,7 @@ module Backup
end
 
def silent
{err: '/dev/null', out: '/dev/null'}
{ err: '/dev/null', out: '/dev/null' }
end
 
private
Loading
Loading
Loading
Loading
@@ -2,7 +2,6 @@ require 'backup/files'
 
module Backup
class Uploads < Files
def initialize
super('uploads', Rails.root.join('public/uploads'))
end
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ def Notify.deliver_later
self
end
eos
eval(code)
eval(code) # rubocop:disable Lint/Eval
end
end
end
Loading
Loading
@@ -46,7 +46,7 @@ module Gitlab
git_tags = fetch_git_tags
git_tags = git_tags.select { |version| version =~ /v\d+\.\d+\.\d+\Z/ }
git_versions = git_tags.map { |tag| Gitlab::VersionInfo.parse(tag.match(/v\d+\.\d+\.\d+/).to_s) }
"v#{git_versions.sort.last.to_s}"
"v#{git_versions.sort.last}"
end
 
def fetch_git_tags
Loading
Loading
@@ -59,10 +59,10 @@ module Gitlab
"Stash changed files" => %W(#{Gitlab.config.git.bin_path} stash),
"Get latest code" => %W(#{Gitlab.config.git.bin_path} fetch),
"Switch to new version" => %W(#{Gitlab.config.git.bin_path} checkout v#{latest_version}),
"Install gems" => %W(bundle),
"Migrate DB" => %W(bundle exec rake db:migrate),
"Recompile assets" => %W(bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile),
"Clear cache" => %W(bundle exec rake cache:clear)
"Install gems" => %w(bundle),
"Migrate DB" => %w(bundle exec rake db:migrate),
"Recompile assets" => %w(bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile),
"Clear cache" => %w(bundle exec rake cache:clear)
}
end
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ desc 'Security check via brakeman'
task :brakeman do
# We get 0 warnings at level 'w3' but we would like to reach 'w2'. Merge
# requests are welcome!
if system(*%W(brakeman --no-progress --skip-files lib/backup/repository.rb -w3 -z))
if system(*%w(brakeman --no-progress --skip-files lib/backup/repository.rb -w3 -z))
puts 'Security check succeed'
else
puts 'Security check failed'
Loading
Loading
namespace :cache do
namespace :clear do
REDIS_CLEAR_BATCH_SIZE = 1000 # There seems to be no speedup when pushing beyond 1,000
REDIS_SCAN_START_STOP = '0' # 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"
task redis: :environment do
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ task dev: ["dev:setup"]
 
namespace :dev do
desc "GitLab | Setup developer environment (db, fixtures)"
task :setup => :environment do
task setup: :environment do
ENV['force'] = 'yes'
Rake::Task["gitlab:setup"].invoke
Rake::Task["gitlab:shell:setup"].invoke
Loading
Loading
desc 'Checks if migrations in a branch require downtime'
task downtime_check: :environment do
if defined?(Gitlab::License)
repo = 'gitlab-ee'
else
repo = 'gitlab-ce'
end
repo = if defined?(Gitlab::License)
'gitlab-ee'
else
'gitlab-ce'
end
 
`git fetch https://gitlab.com/gitlab-org/#{repo}.git --depth 1`
 
Loading
Loading
desc 'Code duplication analyze via flay'
task :flay do
output = %x(bundle exec flay --mass 35 app/ lib/gitlab/)
output = `bundle exec flay --mass 35 app/ lib/gitlab/`
 
if output.include? "Similar code found"
puts output
Loading
Loading
Loading
Loading
@@ -81,9 +81,9 @@ namespace :gemojione do
 
# SpriteFactory's SCSS is a bit too verbose for our purposes here, so
# let's simplify it
system(%Q(sed -i '' "s/width: #{SIZE}px; height: #{SIZE}px; background: image-url('emoji.png')/background-position:/" #{style_path}))
system(%Q(sed -i '' "s/ no-repeat//" #{style_path}))
system(%Q(sed -i '' "s/ 0px/ 0/" #{style_path}))
system(%(sed -i '' "s/width: #{SIZE}px; height: #{SIZE}px; background: image-url('emoji.png')/background-position:/" #{style_path}))
system(%(sed -i '' "s/ no-repeat//" #{style_path}))
system(%(sed -i '' "s/ 0px/ 0/" #{style_path}))
 
# Append a generic rule that applies to all Emojis
File.open(style_path, 'a') do |f|
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@ namespace :gitlab do
desc 'GitLab | Assets | Fix all absolute url references in CSS'
task :fix_urls do
css_files = Dir['public/assets/*.css']
css_files.each do | file |
css_files.each do |file|
# replace url(/assets/*) with url(./*)
puts "Fixing #{file}"
system "sed", "-i", "-e", 's/url(\([\"\']\?\)\/assets\//url(\1.\//g', file
Loading
Loading
Loading
Loading
@@ -6,8 +6,6 @@ namespace :gitlab do
gitlab:ldap:check
gitlab:app:check}
 
namespace :app do
desc "GitLab | Check the configuration of the GitLab Rails app"
task check: :environment do
Loading
Loading
@@ -34,7 +32,6 @@ namespace :gitlab do
finished_checking "GitLab"
end
 
# Checks
########################
 
Loading
Loading
@@ -194,7 +191,7 @@ namespace :gitlab do
def check_migrations_are_up
print "All migrations up? ... "
 
migration_status, _ = Gitlab::Popen.popen(%W(bundle exec rake db:migrate:status))
migration_status, _ = Gitlab::Popen.popen(%w(bundle exec rake db:migrate:status))
 
unless migration_status =~ /down\s+\d{14}/
puts "yes".color(:green)
Loading
Loading
@@ -279,7 +276,7 @@ namespace :gitlab do
upload_path_tmp = File.join(upload_path, 'tmp')
 
if File.stat(upload_path).mode == 040700
unless Dir.exists?(upload_path_tmp)
unless Dir.exist?(upload_path_tmp)
puts 'skipped (no tmp uploads folder yet)'.color(:magenta)
return
end
Loading
Loading
@@ -316,7 +313,7 @@ namespace :gitlab do
min_redis_version = "2.8.0"
print "Redis version >= #{min_redis_version}? ... "
 
redis_version = run_command(%W(redis-cli --version))
redis_version = run_command(%w(redis-cli --version))
redis_version = redis_version.try(:match, /redis-cli (\d+\.\d+\.\d+)/)
if redis_version &&
(Gem::Version.new(redis_version[1]) > Gem::Version.new(min_redis_version))
Loading
Loading
@@ -351,7 +348,6 @@ namespace :gitlab do
finished_checking "GitLab Shell"
end
 
# Checks
########################
 
Loading
Loading
@@ -387,7 +383,7 @@ namespace :gitlab do
 
unless File.exist?(repo_base_path)
puts "can't check because of previous errors".color(:magenta)
return
break
end
 
unless File.symlink?(repo_base_path)
Loading
Loading
@@ -410,7 +406,7 @@ namespace :gitlab do
 
unless File.exist?(repo_base_path)
puts "can't check because of previous errors".color(:magenta)
return
break
end
 
if File.stat(repo_base_path).mode.to_s(8).ends_with?("2770")
Loading
Loading
@@ -440,7 +436,7 @@ namespace :gitlab do
 
unless File.exist?(repo_base_path)
puts "can't check because of previous errors".color(:magenta)
return
break
end
 
uid = uid_for(gitlab_shell_ssh_user)
Loading
Loading
@@ -493,7 +489,6 @@ namespace :gitlab do
)
fix_and_rerun
end
end
end
 
Loading
Loading
@@ -565,8 +560,6 @@ namespace :gitlab do
end
end
 
namespace :sidekiq do
desc "GitLab | Check the configuration of Sidekiq"
task check: :environment do
Loading
Loading
@@ -579,7 +572,6 @@ namespace :gitlab do
finished_checking "Sidekiq"
end
 
# Checks
########################
 
Loading
Loading
@@ -621,12 +613,11 @@ namespace :gitlab do
end
 
def sidekiq_process_count
ps_ux, _ = Gitlab::Popen.popen(%W(ps ux))
ps_ux, _ = Gitlab::Popen.popen(%w(ps ux))
ps_ux.scan(/sidekiq \d+\.\d+\.\d+/).count
end
end
 
namespace :incoming_email do
desc "GitLab | Check the configuration of Reply by email"
task check: :environment do
Loading
Loading
@@ -649,7 +640,6 @@ namespace :gitlab do
finished_checking "Reply by email"
end
 
# Checks
########################
 
Loading
Loading
@@ -757,7 +747,7 @@ namespace :gitlab do
end
 
def mail_room_running?
ps_ux, _ = Gitlab::Popen.popen(%W(ps ux))
ps_ux, _ = Gitlab::Popen.popen(%w(ps ux))
ps_ux.include?("mail_room")
end
end
Loading
Loading
@@ -805,13 +795,13 @@ namespace :gitlab do
def check_ldap_auth(adapter)
auth = adapter.config.has_auth?
 
if auth && adapter.ldap.bind
message = 'Success'.color(:green)
elsif auth
message = 'Failed. Check `bind_dn` and `password` configuration values'.color(:red)
else
message = 'Anonymous. No `bind_dn` or `password` configured'.color(:yellow)
end
message = if auth && adapter.ldap.bind
'Success'.color(:green)
elsif auth
'Failed. Check `bind_dn` and `password` configuration values'.color(:red)
else
'Anonymous. No `bind_dn` or `password` configured'.color(:yellow)
end
 
puts "LDAP authentication... #{message}"
end
Loading
Loading
@@ -838,11 +828,11 @@ namespace :gitlab do
user = User.find_by(username: username)
if user
repo_dirs = user.authorized_projects.map do |p|
File.join(
p.repository_storage_path,
"#{p.path_with_namespace}.git"
)
end
File.join(
p.repository_storage_path,
"#{p.path_with_namespace}.git"
)
end
 
repo_dirs.each { |repo_dir| check_repo_integrity(repo_dir) }
else
Loading
Loading
@@ -855,7 +845,7 @@ namespace :gitlab do
##########################
 
def fix_and_rerun
puts " Please #{"fix the error above"} and rerun the checks.".color(:red)
puts " Please fix the error above and rerun the checks.".color(:red)
end
 
def for_more_information(*sources)
Loading
Loading
@@ -917,7 +907,7 @@ namespace :gitlab do
 
def check_ruby_version
required_version = Gitlab::VersionInfo.new(2, 1, 0)
current_version = Gitlab::VersionInfo.parse(run_command(%W(ruby --version)))
current_version = Gitlab::VersionInfo.parse(run_command(%w(ruby --version)))
 
print "Ruby version >= #{required_version} ? ... "
 
Loading
Loading
@@ -988,13 +978,13 @@ namespace :gitlab do
end
 
def check_config_lock(repo_dir)
config_exists = File.exist?(File.join(repo_dir,'config.lock'))
config_exists = File.exist?(File.join(repo_dir, 'config.lock'))
config_output = config_exists ? 'yes'.color(:red) : 'no'.color(:green)
puts "'config.lock' file exists?".color(:yellow) + " ... #{config_output}"
end
 
def check_ref_locks(repo_dir)
lock_files = Dir.glob(File.join(repo_dir,'refs/heads/*.lock'))
lock_files = Dir.glob(File.join(repo_dir, 'refs/heads/*.lock'))
if lock_files.present?
puts "Ref lock files exist:".color(:red)
lock_files.each do |lock_file|
Loading
Loading
Loading
Loading
@@ -25,7 +25,6 @@ namespace :gitlab do
end
 
all_dirs.each do |dir_path|
if remove_flag
if FileUtils.rm_rf dir_path
puts "Removed...#{dir_path}".color(:red)
Loading
Loading
@@ -53,11 +52,11 @@ namespace :gitlab do
IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *.git)) do |find|
find.each_line do |path|
path.chomp!
repo_with_namespace = path.
sub(repo_root, '').
sub(%r{^/*}, '').
chomp('.git').
chomp('.wiki')
repo_with_namespace = path
.sub(repo_root, '')
.sub(%r{^/*}, '')
.chomp('.git')
.chomp('.wiki')
next if Project.find_by_full_path(repo_with_namespace)
new_path = path + move_suffix
puts path.inspect + ' -> ' + new_path.inspect
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ namespace :gitlab do
end
 
desc 'Drop all tables'
task :drop_tables => :environment do
task drop_tables: :environment do
connection = ActiveRecord::Base.connection
 
# If MySQL, turn off foreign key checks
Loading
Loading
@@ -62,9 +62,9 @@ namespace :gitlab do
 
ref = Shellwords.escape(args[:ref])
 
migrations = `git diff #{ref}.. --name-only -- db/migrate`.lines.
map { |file| Rails.root.join(file.strip).to_s }.
select { |file| File.file?(file) }
migrations = `git diff #{ref}.. --name-only -- db/migrate`.lines
.map { |file| Rails.root.join(file.strip).to_s }
.select { |file| File.file?(file) }
 
Gitlab::DowntimeCheck.new.check_and_print(migrations)
end
Loading
Loading
namespace :gitlab do
namespace :git do
desc "GitLab | Git | Repack"
task repack: :environment do
failures = perform_git_cmd(%W(#{Gitlab.config.git.bin_path} repack -a --quiet), "Repacking repo")
Loading
Loading
@@ -50,6 +49,5 @@ namespace :gitlab do
puts "The following repositories reported errors:".color(:red)
failures.each { |f| puts "- #{f}" }
end
end
end
Loading
Loading
@@ -46,7 +46,7 @@ namespace :gitlab do
group = Namespace.find_by(path: group_name)
# create group namespace
unless group
group = Group.new(:name => group_name)
group = Group.new(name: group_name)
group.path = group_name
group.owner = user
if group.save
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment