Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
56e6e8c5
Commit
56e6e8c5
authored
Jul 13, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add setting to disable usage ping
parent
f493c9a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
2 deletions
+25
-2
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+1
-0
app/models/application_setting.rb
app/models/application_setting.rb
+1
-0
app/views/admin/application_settings/_form.html.haml
app/views/admin/application_settings/_form.html.haml
+9
-0
app/workers/gitlab_usage_ping_worker.rb
app/workers/gitlab_usage_ping_worker.rb
+2
-0
db/schema.rb
db/schema.rb
+3
-2
spec/workers/gitlab_usage_ping_worker_spec.rb
spec/workers/gitlab_usage_ping_worker_spec.rb
+9
-0
No files found.
app/controllers/admin/application_settings_controller.rb
View file @
56e6e8c5
...
...
@@ -118,6 +118,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:elasticsearch_search
,
:elasticsearch_host
,
:elasticsearch_port
,
:usage_ping_enabled
,
:repository_storage
,
:enabled_git_access_protocol
,
restricted_visibility_levels:
[],
...
...
app/models/application_setting.rb
View file @
56e6e8c5
...
...
@@ -151,6 +151,7 @@ class ApplicationSetting < ActiveRecord::Base
container_registry_token_expire_delay:
5
,
elasticsearch_host:
ENV
[
'ELASTIC_HOST'
]
||
'localhost'
,
elasticsearch_port:
ENV
[
'ELASTIC_PORT'
]
||
'9200'
,
usage_ping_enabled:
true
,
repository_storage:
'default'
,
user_default_external:
false
,
)
...
...
app/views/admin/application_settings/_form.html.haml
View file @
56e6e8c5
...
...
@@ -55,6 +55,15 @@
=
f
.
label
:version_check_enabled
do
=
f
.
check_box
:version_check_enabled
Version check enabled
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
=
f
.
label
:usage_ping_enabled
do
=
f
.
check_box
:usage_ping_enabled
Usage ping enabled
.help-block
Every week GitLab will report license usage back to a GitLab server.
Disable this option if you do not want this to occur.
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
...
...
app/workers/gitlab_usage_ping_worker.rb
View file @
56e6e8c5
...
...
@@ -9,6 +9,8 @@ class GitlabUsagePingWorker
sidekiq_options
queue: :default
,
retry:
false
def
perform
return
unless
current_application_settings
.
usage_ping_enabled
# Multiple Sidekiq workers could run this. We should only do this at most once a day.
return
unless
try_obtain_lease
...
...
db/schema.rb
View file @
56e6e8c5
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2016071
2171823
)
do
ActiveRecord
::
Schema
.
define
(
version:
2016071
3222618
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -94,7 +94,8 @@ ActiveRecord::Schema.define(version: 20160712171823) do
t
.
string
"elasticsearch_host"
,
default:
"localhost"
t
.
string
"elasticsearch_port"
,
default:
"9200"
t
.
string
"repository_storage"
,
default:
"default"
t
.
string
"enabled_git_access_protocol"
t
.
string
"enabled_git_access_protocol"
,
t
.
boolean
"usage_ping_enabled"
,
default:
true
,
null:
false
end
create_table
"approvals"
,
force: :cascade
do
|
t
|
...
...
spec/workers/gitlab_usage_ping_worker_spec.rb
View file @
56e6e8c5
...
...
@@ -19,10 +19,19 @@ describe GitlabUsagePingWorker do
end
it
"sends POST request"
do
stub_application_setting
(
usage_ping_enabled:
true
)
stub_request
(
:post
,
"https://version.gitlab.com/usage_ping"
).
to_return
(
status:
200
,
body:
''
,
headers:
{})
expect
(
subject
).
to
receive
(
:try_obtain_lease
).
and_return
(
true
)
expect
(
subject
.
perform
.
response
.
code
.
to_i
).
to
eq
(
200
)
end
it
"does not run if usage ping is disabled"
do
stub_application_setting
(
usage_ping_enabled:
false
)
expect
(
subject
).
not_to
receive
(
:try_obtain_lease
)
expect
(
subject
).
not_to
receive
(
:perform
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment