summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-09-22 13:10:33 +0200
committerJarka Kadlecova <jarka@gitlab.com>2017-09-22 13:10:33 +0200
commit8d571b146d518a979ea0cbe062abbb576a58927c (patch)
tree24647b75f1de71aa92f0e00155c3e25d4250ee4e
parent84a7c4872cd5daba573d7278ddc354ab5dc6927e (diff)
parentfa72d3461ad8df8c967d83c4faff14ab8c770d0b (diff)
downloadgitlab-ce-8d571b146d518a979ea0cbe062abbb576a58927c.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-cev10.1.0.pre
-rw-r--r--app/models/repository.rb1
-rw-r--r--changelogs/unreleased/33328-usage-ping-for-gitlab-features-and-components.yml5
-rw-r--r--changelogs/unreleased/38197-fix-ImapAuthenticationCheck.yml5
-rw-r--r--changelogs/unreleased/38234-reserve-refs-replace.yml5
-rw-r--r--lib/gitlab/usage_data.rb46
-rw-r--r--lib/system_check/incoming_email/imap_authentication_check.rb45
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb36
7 files changed, 116 insertions, 27 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index f11cf1b065d..90cede9d3d4 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -8,6 +8,7 @@ class Repository
RESERVED_REFS_NAMES = %W[
heads
tags
+ replace
#{REF_ENVIRONMENTS}
#{REF_KEEP_AROUND}
#{REF_ENVIRONMENTS}
diff --git a/changelogs/unreleased/33328-usage-ping-for-gitlab-features-and-components.yml b/changelogs/unreleased/33328-usage-ping-for-gitlab-features-and-components.yml
new file mode 100644
index 00000000000..d3aac241b75
--- /dev/null
+++ b/changelogs/unreleased/33328-usage-ping-for-gitlab-features-and-components.yml
@@ -0,0 +1,5 @@
+---
+title: Adds gitlab features and components to usage ping data.
+merge_request: 14305
+author:
+type: other
diff --git a/changelogs/unreleased/38197-fix-ImapAuthenticationCheck.yml b/changelogs/unreleased/38197-fix-ImapAuthenticationCheck.yml
new file mode 100644
index 00000000000..df562077fb3
--- /dev/null
+++ b/changelogs/unreleased/38197-fix-ImapAuthenticationCheck.yml
@@ -0,0 +1,5 @@
+---
+title: Fix `rake gitlab:incoming_email:check` and make it report the actual error
+merge_request: 14423
+author:
+type: fixed
diff --git a/changelogs/unreleased/38234-reserve-refs-replace.yml b/changelogs/unreleased/38234-reserve-refs-replace.yml
new file mode 100644
index 00000000000..3a5ffbf9db0
--- /dev/null
+++ b/changelogs/unreleased/38234-reserve-refs-replace.yml
@@ -0,0 +1,5 @@
+---
+title: Also reserve refs/replace after importing a project
+merge_request: 14436
+author:
+type: fixed
diff --git a/lib/gitlab/usage_data.rb b/lib/gitlab/usage_data.rb
index 36708078136..6857038dba8 100644
--- a/lib/gitlab/usage_data.rb
+++ b/lib/gitlab/usage_data.rb
@@ -9,12 +9,28 @@ module Gitlab
def uncached_data
license_usage_data.merge(system_usage_data)
+ .merge(features_usage_data)
+ .merge(components_usage_data)
end
def to_json(force_refresh: false)
data(force_refresh: force_refresh).to_json
end
+ def license_usage_data
+ usage_data = {
+ uuid: current_application_settings.uuid,
+ hostname: Gitlab.config.gitlab.host,
+ version: Gitlab::VERSION,
+ active_user_count: User.active.count,
+ recorded_at: Time.now,
+ mattermost_enabled: Gitlab.config.mattermost.enabled,
+ edition: 'CE'
+ }
+
+ usage_data
+ end
+
def system_usage_data
{
counts: {
@@ -54,18 +70,28 @@ module Gitlab
}
end
- def license_usage_data
- usage_data = {
- uuid: current_application_settings.uuid,
- hostname: Gitlab.config.gitlab.host,
- version: Gitlab::VERSION,
- active_user_count: User.active.count,
- recorded_at: Time.now,
- mattermost_enabled: Gitlab.config.mattermost.enabled,
- edition: 'CE'
+ def features_usage_data
+ features_usage_data_ce
+ end
+
+ def features_usage_data_ce
+ {
+ signup: current_application_settings.signup_enabled?,
+ ldap: Gitlab.config.ldap.enabled,
+ gravatar: current_application_settings.gravatar_enabled?,
+ omniauth: Gitlab.config.omniauth.enabled,
+ reply_by_email: Gitlab::IncomingEmail.enabled?,
+ container_registry: Gitlab.config.registry.enabled,
+ gitlab_shared_runners: Gitlab.config.gitlab_ci.shared_runners_enabled
}
+ end
- usage_data
+ def components_usage_data
+ {
+ gitlab_pages: { enabled: Gitlab.config.pages.enabled, version: Gitlab::Pages::VERSION },
+ git: { version: Gitlab::Git.version },
+ database: { adapter: Gitlab::Database.adapter_name, version: Gitlab::Database.version }
+ }
end
def services_usage
diff --git a/lib/system_check/incoming_email/imap_authentication_check.rb b/lib/system_check/incoming_email/imap_authentication_check.rb
index dee108d987b..e55bea86d3f 100644
--- a/lib/system_check/incoming_email/imap_authentication_check.rb
+++ b/lib/system_check/incoming_email/imap_authentication_check.rb
@@ -4,22 +4,17 @@ module SystemCheck
set_name 'IMAP server credentials are correct?'
def check?
- if mailbox_config
- begin
- imap = Net::IMAP.new(config[:host], port: config[:port], ssl: config[:ssl])
- imap.starttls if config[:start_tls]
- imap.login(config[:email], config[:password])
- connected = true
- rescue
- connected = false
- end
+ if config
+ try_connect_imap
+ else
+ @error = "#{mail_room_config_path} does not have mailboxes setup"
+ false
end
-
- connected
end
def show_error
try_fixing_it(
+ "An error occurred: #{@error.class}: #{@error.message}",
'Check that the information in config/gitlab.yml is correct'
)
for_more_information(
@@ -30,15 +25,31 @@ module SystemCheck
private
- def mailbox_config
- return @config if @config
+ def try_connect_imap
+ imap = Net::IMAP.new(config[:host], port: config[:port], ssl: config[:ssl])
+ imap.starttls if config[:start_tls]
+ imap.login(config[:email], config[:password])
+ true
+ rescue => error
+ @error = error
+ false
+ end
+
+ def config
+ @config ||= load_config
+ end
+
+ def mail_room_config_path
+ @mail_room_config_path ||=
+ Rails.root.join('config', 'mail_room.yml').to_s
+ end
- config_path = Rails.root.join('config', 'mail_room.yml').to_s
- erb = ERB.new(File.read(config_path))
- erb.filename = config_path
+ def load_config
+ erb = ERB.new(File.read(mail_room_config_path))
+ erb.filename = mail_room_config_path
config_file = YAML.load(erb.result)
- @config = config_file[:mailboxes]&.first
+ config_file.dig(:mailboxes, 0)
end
end
end
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
index c7d9f105f04..ee152872acc 100644
--- a/spec/lib/gitlab/usage_data_spec.rb
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -26,6 +26,16 @@ describe Gitlab::UsageData do
version
uuid
hostname
+ signup
+ ldap
+ gravatar
+ omniauth
+ reply_by_email
+ container_registry
+ gitlab_pages
+ gitlab_shared_runners
+ git
+ database
))
end
@@ -86,6 +96,32 @@ describe Gitlab::UsageData do
end
end
+ describe '#features_usage_data_ce' do
+ subject { described_class.features_usage_data_ce }
+
+ it 'gathers feature usage data' do
+ expect(subject[:signup]).to eq(current_application_settings.signup_enabled?)
+ expect(subject[:ldap]).to eq(Gitlab.config.ldap.enabled)
+ expect(subject[:gravatar]).to eq(current_application_settings.gravatar_enabled?)
+ expect(subject[:omniauth]).to eq(Gitlab.config.omniauth.enabled)
+ expect(subject[:reply_by_email]).to eq(Gitlab::IncomingEmail.enabled?)
+ expect(subject[:container_registry]).to eq(Gitlab.config.registry.enabled)
+ expect(subject[:gitlab_shared_runners]).to eq(Gitlab.config.gitlab_ci.shared_runners_enabled)
+ end
+ end
+
+ describe '#components_usage_data' do
+ subject { described_class.components_usage_data }
+
+ it 'gathers components usage data' do
+ expect(subject[:gitlab_pages][:enabled]).to eq(Gitlab.config.pages.enabled)
+ expect(subject[:gitlab_pages][:version]).to eq(Gitlab::Pages::VERSION)
+ expect(subject[:git][:version]).to eq(Gitlab::Git.version)
+ expect(subject[:database][:adapter]).to eq(Gitlab::Database.adapter_name)
+ expect(subject[:database][:version]).to eq(Gitlab::Database.version)
+ end
+ end
+
describe '#license_usage_data' do
subject { described_class.license_usage_data }