summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-11 10:22:05 +0100
committerGrzegorz Bizon <grzegorz.bizon@ntsn.pl>2015-12-11 10:39:39 +0100
commit2da3cf314651d22f85059d99476ec7952950b44f (patch)
treed2481262005e72bb23f846d53c6ee33da166aa09
parente2e43a114b5af63aad6d9badcb727c8829abb167 (diff)
downloadgitlab-ce-2da3cf314651d22f85059d99476ec7952950b44f.tar.gz
Add CI runners registration token reset button
-rw-r--r--app/controllers/admin/application_settings_controller.rb6
-rw-r--r--app/views/ci/admin/runners/index.html.haml13
-rw-r--r--config/routes.rb1
3 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index a9bcfc7456a..48040359389 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -13,6 +13,12 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
end
+ def reset_runners_token
+ @application_setting.reset_runners_registration_token!
+ flash[:notice] = 'New runners registration token has been generated!'
+ redirect_to ci_admin_runners_path
+ end
+
private
def set_application_setting
diff --git a/app/views/ci/admin/runners/index.html.haml b/app/views/ci/admin/runners/index.html.haml
index c71710a831c..95bc8ebd40f 100644
--- a/app/views/ci/admin/runners/index.html.haml
+++ b/app/views/ci/admin/runners/index.html.haml
@@ -3,7 +3,18 @@
To register a new runner you should enter the following registration token.
With this token the runner will request a unique runner token and use that for future communication.
Registration token is
- %code #{current_application_settings.runners_registration_token}
+ %code{ id: 'runners-token' } #{current_application_settings.runners_registration_token}
+
+.bs-callout.clearfix
+ .pull-left
+ %p
+ You can reset runners registration token by pressing a button below.
+ %p
+ = button_to reset_runners_token_admin_application_settings_path,
+ method: :put, class: 'btn btn-default',
+ data: { confirm: 'Are you sure you want to reset registration token?' } do
+ = icon('refresh')
+ Reset runners registration token
.bs-callout
%p
diff --git a/config/routes.rb b/config/routes.rb
index 061a8fd5da4..54d6afe2dca 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -276,6 +276,7 @@ Rails.application.routes.draw do
resource :application_settings, only: [:show, :update] do
resources :services
+ put :reset_runners_token
end
resources :labels