2012-12-05 12:27:54 -05:00
|
|
|
namespace :gitlab do
|
2012-12-06 15:16:48 -05:00
|
|
|
namespace :env do
|
2020-01-23 01:08:32 -05:00
|
|
|
desc 'GitLab | Env | 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
|
2019-03-26 12:01:19 -04:00
|
|
|
|
|
|
|
# check for system defined proxies
|
|
|
|
if Gitlab.ee?
|
|
|
|
proxies = Gitlab::Proxy.detect_proxy.map {|k, v| "#{k}: #{v}"}.join("\n\t\t")
|
|
|
|
end
|
|
|
|
|
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)}"
|
2019-03-26 12:01:19 -04:00
|
|
|
|
|
|
|
if Gitlab.ee?
|
|
|
|
puts "Proxy:\t\t#{proxies.present? ? proxies.color(:green) : "no"}"
|
|
|
|
end
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
2019-03-26 12:01:19 -04:00
|
|
|
if Gitlab.ee?
|
|
|
|
geo_node_type =
|
|
|
|
if Gitlab::Geo.current_node
|
|
|
|
Gitlab::Geo.current_node.primary ? 'Primary' : 'Secondary'
|
|
|
|
else
|
|
|
|
'Undefined'.color(:red)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
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}"
|
2018-05-24 03:57:54 -04:00
|
|
|
puts "Revision:\t#{Gitlab.revision}"
|
2012-12-06 15:16:48 -05:00
|
|
|
puts "Directory:\t#{Rails.root}"
|
2019-03-21 16:05:01 -04:00
|
|
|
puts "DB Adapter:\t#{Gitlab::Database.human_adapter_name}"
|
|
|
|
puts "DB Version:\t#{Gitlab::Database.version}"
|
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}"
|
2019-03-26 12:01:19 -04:00
|
|
|
|
|
|
|
if Gitlab.ee?
|
|
|
|
puts "Elasticsearch:\t#{Gitlab::CurrentSettings.current_application_settings.elasticsearch_indexing? ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Geo:\t\t#{Gitlab::Geo.enabled? ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Geo node:\t#{geo_node_type}" if Gitlab::Geo.enabled?
|
|
|
|
end
|
|
|
|
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "Using LDAP:\t#{Gitlab.config.ldap.enabled ? "yes".color(:green) : "no"}"
|
2018-07-13 06:39:31 -04:00
|
|
|
puts "Using Omniauth:\t#{Gitlab::Auth.omniauth_enabled? ? "yes".color(:green) : "no"}"
|
|
|
|
puts "Omniauth Providers: #{omniauth_providers.join(', ')}" if Gitlab::Auth.omniauth_enabled?
|
2012-12-06 15:16:48 -05:00
|
|
|
|
2020-03-16 08:09:12 -04:00
|
|
|
# check Gitlab Shell version
|
2012-12-05 12:27:54 -05:00
|
|
|
puts ""
|
2016-06-01 18:37:15 -04:00
|
|
|
puts "GitLab Shell".color(:yellow)
|
2020-03-16 08:09:12 -04:00
|
|
|
puts "Version:\t#{Gitlab::Shell.version || "unknown".color(:red)}"
|
2016-06-22 17:04:51 -04:00
|
|
|
puts "Repository storage paths:"
|
2018-06-05 11:58:28 -04:00
|
|
|
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
|
|
|
|
Gitlab.config.repositories.storages.each do |name, repository_storage|
|
|
|
|
puts "- #{name}: \t#{repository_storage.legacy_disk_path}"
|
|
|
|
end
|
2016-06-22 17:04:51 -04:00
|
|
|
end
|
2019-02-27 05:58:21 -05:00
|
|
|
puts "GitLab Shell path:\t\t#{Gitlab.config.gitlab_shell.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
|