2012-12-05 12:27:54 -05:00
|
|
|
namespace :gitlab do
|
2012-12-06 15:16:48 -05:00
|
|
|
namespace :env do
|
2015-06-23 10:52:40 -04:00
|
|
|
desc "GitLab | Show information about GitLab and its environment"
|
2018-01-24 03:12:33 -05:00
|
|
|
task info: :gitlab_environment do
|
2012-12-06 15:16:48 -05:00
|
|
|
# check if there is an RVM environment
|
2017-02-22 13:18:40 -05:00
|
|
|
rvm_version = run_and_match(%w(rvm --version), /[\d\.]+/).try(:to_s)
|
2012-12-10 16:53:33 -05:00
|
|
|
# check Ruby version
|
2017-02-22 13:18:40 -05:00
|
|
|
ruby_version = run_and_match(%w(ruby --version), /[\d\.p]+/).try(:to_s)
|
2012-12-07 10:42:09 -05:00
|
|
|
# check Gem version
|
2017-02-22 13:18:40 -05:00
|
|
|
gem_version = run_command(%w(gem --version))
|
2012-12-06 15:16:48 -05:00
|
|
|
# check Bundler version
|
2017-02-22 13:18:40 -05:00
|
|
|
bunder_version = run_and_match(%w(bundle --version), /[\d\.]+/).try(:to_s)
|
2016-12-22 23:02:19 -05:00
|
|
|
# check Rake version
|
2017-02-22 13:18:40 -05:00
|
|
|
rake_version = run_and_match(%w(rake --version), /[\d\.]+/).try(:to_s)
|
2016-12-22 23:02:19 -05:00
|
|
|
# check redis version
|
2017-02-22 13:18:40 -05:00
|
|
|
redis_version = run_and_match(%w(redis-cli --version), /redis-cli (\d+\.\d+\.\d+)/).to_a
|
2016-12-06 13:19:37 -05:00
|
|
|
# check Git version
|
|
|
|
git_version = run_and_match([Gitlab.config.git.bin_path, '--version'], /git version ([\d\.]+)/).to_a
|
2017-05-10 07:21:23 -04:00
|
|
|
# check Go version
|
|
|
|
go_version = run_and_match(%w(go version), /go version (.+)/).to_a
|
2012-12-06 15:16:48 -05:00
|
|
|
|
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "System information".color(:yellow)
|
|
|
|
puts "System:\t\t#{os_name || "unknown".color(:red)}"
|
2017-02-22 13:18:40 -05:00
|
|
|
puts "Current User:\t#{run_command(%w(whoami))}"
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Using RVM:\t#{rvm_version.present? ? "yes".color(:green) : "no"}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "RVM Version:\t#{rvm_version}" if rvm_version.present?
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Ruby Version:\t#{ruby_version || "unknown".color(:red)}"
|
|
|
|
puts "Gem Version:\t#{gem_version || "unknown".color(:red)}"
|
|
|
|
puts "Bundler Version:#{bunder_version || "unknown".color(:red)}"
|
|
|
|
puts "Rake Version:\t#{rake_version || "unknown".color(:red)}"
|
2016-12-22 23:02:19 -05:00
|
|
|
puts "Redis Version:\t#{redis_version[1] || "unknown".color(:red)}"
|
2016-12-06 13:19:37 -05:00
|
|
|
puts "Git Version:\t#{git_version[1] || "unknown".color(:red)}"
|
2014-04-01 10:05:26 -04:00
|
|
|
puts "Sidekiq Version:#{Sidekiq::VERSION}"
|
2017-05-10 07:21:23 -04:00
|
|
|
puts "Go Version:\t#{go_version[1] || "unknown".color(:red)}"
|
2012-12-06 15:16:48 -05:00
|
|
|
|
|
|
|
# check database adapter
|
|
|
|
database_adapter = ActiveRecord::Base.connection.adapter_name.downcase
|
|
|
|
|
2015-08-17 06:41:47 -04:00
|
|
|
project = Group.new(path: "some-group").projects.build(path: "some-project")
|
2012-12-06 15:16:48 -05:00
|
|
|
# construct clone URLs
|
|
|
|
http_clone_url = project.http_url_to_repo
|
|
|
|
ssh_clone_url = project.ssh_url_to_repo
|
|
|
|
|
2017-06-30 12:36:36 -04:00
|
|
|
omniauth_providers = Gitlab.config.omniauth.providers.map { |provider| provider['name'] }
|
2012-12-10 16:53:33 -05:00
|
|
|
|
2012-12-06 15:16:48 -05:00
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "GitLab information".color(:yellow)
|
2013-02-16 07:42:22 -05:00
|
|
|
puts "Version:\t#{Gitlab::VERSION}"
|
|
|
|
puts "Revision:\t#{Gitlab::REVISION}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "Directory:\t#{Rails.root}"
|
|
|
|
puts "DB Adapter:\t#{database_adapter}"
|
2012-12-14 19:16:25 -05:00
|
|
|
puts "URL:\t\t#{Gitlab.config.gitlab.url}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "HTTP Clone URL:\t#{http_clone_url}"
|
|
|
|
puts "SSH Clone URL:\t#{ssh_clone_url}"
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Using Omniauth:\t#{Gitlab.config.omniauth.enabled ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Omniauth Providers: #{omniauth_providers.join(', ')}" if Gitlab.config.omniauth.enabled
|
2012-12-06 15:16:48 -05:00
|
|
|
|
|
|
|
# check Gitolite version
|
2013-08-22 14:10:18 -04:00
|
|
|
gitlab_shell_version_file = "#{Gitlab.config.gitlab_shell.hooks_path}/../VERSION"
|
2013-02-11 12:16:59 -05:00
|
|
|
if File.readable?(gitlab_shell_version_file)
|
|
|
|
gitlab_shell_version = File.read(gitlab_shell_version_file)
|
2012-12-05 12:27:54 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "GitLab Shell".color(:yellow)
|
|
|
|
puts "Version:\t#{gitlab_shell_version || "unknown".color(:red)}"
|
2016-06-22 17:04:51 -04:00
|
|
|
puts "Repository storage paths:"
|
2017-02-28 16:08:40 -05:00
|
|
|
Gitlab.config.repositories.storages.each do |name, repository_storage|
|
2018-03-14 09:42:49 -04:00
|
|
|
puts "- #{name}: \t#{repository_storage.legacy_disk_path}"
|
2016-06-22 17:04:51 -04:00
|
|
|
end
|
2013-02-11 12:16:59 -05:00
|
|
|
puts "Hooks:\t\t#{Gitlab.config.gitlab_shell.hooks_path}"
|
2012-12-14 19:16:25 -05:00
|
|
|
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
|
2012-12-05 12:27:54 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|