Commit 8ec0eda9 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '41922-simplify-runner-registration-token-resetting' into 'master'

Simplify runner registration token resetting

Closes #41922

See merge request gitlab-org/gitlab-ce!21658
parents f3b3ee78 5a60a546
......@@ -67,8 +67,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
end
def reset_runners_token
def reset_registration_token
@application_setting.reset_runners_registration_token!
flash[:notice] = 'New runners registration token has been generated!'
redirect_to admin_runners_path
end
......
......@@ -10,6 +10,13 @@ module Groups
define_secret_variables
end
def reset_registration_token
@group.reset_runners_token!
flash[:notice] = 'New runners registration token has been generated!'
redirect_to group_settings_ci_cd_path
end
private
def define_secret_variables
......
......@@ -36,6 +36,13 @@ module Projects
end
end
def reset_registration_token
@project.reset_runners_token!
flash[:notice] = 'New runners registration token has been generated!'
redirect_to namespace_project_settings_ci_cd_path
end
private
def update_params
......
......@@ -2,6 +2,8 @@
- @no_container = true
%div{ class: container_class }
.row
.col-sm-6
.bs-callout
%p
= (_"A 'Runner' is a process which runs a job. You can set up as many Runners as you need.")
......@@ -33,23 +35,15 @@
\-
= _('Runner will not receive any new jobs')
.bs-callout.clearfix
.float-left
%p
= _('You can reset runners registration token by pressing a button below.')
.prepend-top-10
= button_to _('Reset runners registration token'), reset_runners_token_admin_application_settings_path,
method: :put, class: 'btn btn-default',
data: { confirm: _('Are you sure you want to reset registration token?') }
= render partial: 'ci/runner/how_to_setup_shared_runner',
locals: { registration_token: Gitlab::CurrentSettings.runners_registration_token }
.col-sm-6
.bs-callout
%p
= _('Runners currently online: %{active_runners_count}') % { active_runners_count: @active_runners_count }
= render partial: 'ci/runner/how_to_setup_runner',
locals: { registration_token: Gitlab::CurrentSettings.runners_registration_token,
type: 'shared',
reset_token_url: reset_registration_token_admin_application_settings_path }
.row-content-block.second-block
.row
.col-sm-9
= form_tag admin_runners_path, id: 'runners-search', method: :get, class: 'filter-form js-filter-form' do
.filtered-search-wrapper
.filtered-search-box
......@@ -103,6 +97,9 @@
.filter-dropdown-container
= render 'sort_dropdown'
.col-sm-3.text-right-lg
= _('Runners currently online: %{active_runners_count}') % { active_runners_count: @active_runners_count }
- if @runners.any?
.runners-content.content-list
.table-holder
......
......@@ -13,5 +13,9 @@
= _("Use the following registration token during setup:")
%code#registration_token= registration_token
= clipboard_button(target: '#registration_token', title: _("Copy token to clipboard"), class: "btn-transparent btn-clipboard")
.prepend-top-10.append-bottom-10
= button_to _("Reset runners registration token"), reset_token_url,
method: :put, class: 'btn btn-default',
data: { confirm: _("Are you sure you want to reset registration token?") }
%li
= _("Start the Runner!")
.bs-callout.help-callout
= render partial: 'ci/runner/how_to_setup_runner',
locals: { registration_token: registration_token, type: 'shared' }
.bs-callout.help-callout
.append-bottom-10
%h4= _('Set up a specific Runner automatically')
%p
- link_to_help_page = link_to(_('Learn more about Kubernetes'),
help_page_path('user/project/clusters/index'),
target: '_blank',
rel: 'noopener noreferrer')
= _('You can easily install a Runner on a Kubernetes cluster. %{link_to_help_page}').html_safe % { link_to_help_page: link_to_help_page }
%ol
%li
= _('Click the button below to begin the install process by navigating to the Kubernetes page')
%li
= _('Select an existing Kubernetes cluster or create a new one')
%li
= _('From the Kubernetes cluster details view, install Runner from the applications list')
= link_to _('Install Runner on Kubernetes'),
project_clusters_path(@project),
class: 'btn btn-info'
%hr
= render partial: 'ci/runner/how_to_setup_runner',
locals: { registration_token: registration_token, type: 'specific' }
......@@ -11,7 +11,9 @@
-# https://gitlab.com/gitlab-org/gitlab-ce/issues/45894
- if can?(current_user, :admin_pipeline, @group)
= render partial: 'ci/runner/how_to_setup_runner',
locals: { registration_token: @group.runners_token, type: 'group' }
locals: { registration_token: @group.runners_token,
type: 'group',
reset_token_url: reset_registration_token_group_settings_ci_cd_path }
- if @group.runners.empty?
%h4.underlined-title
......
%h3
= _('Specific Runners')
= render partial: 'ci/runner/how_to_setup_specific_runner',
locals: { registration_token: @project.runners_token }
.bs-callout.help-callout
.append-bottom-10
%h4= _('Set up a specific Runner automatically')
%p
- link_to_help_page = link_to(_('Learn more about Kubernetes'),
help_page_path('user/project/clusters/index'),
target: '_blank',
rel: 'noopener noreferrer')
= _('You can easily install a Runner on a Kubernetes cluster. %{link_to_help_page}').html_safe % { link_to_help_page: link_to_help_page }
%ol
%li
= _('Click the button below to begin the install process by navigating to the Kubernetes page')
%li
= _('Select an existing Kubernetes cluster or create a new one')
%li
= _('From the Kubernetes cluster details view, install Runner from the applications list')
= link_to _('Install Runner on Kubernetes'),
project_clusters_path(@project),
class: 'btn btn-info'
%hr
= render partial: 'ci/runner/how_to_setup_runner',
locals: { registration_token: @project.runners_token,
type: 'specific',
reset_token_url: reset_registration_token_namespace_project_settings_ci_cd_path }
- if @project_runners.any?
%h4.underlined-title Runners activated for this project
......
......@@ -3,16 +3,6 @@
= form_for @project, url: project_settings_ci_cd_path(@project, anchor: 'js-general-pipeline-settings') do |f|
= form_errors(@project)
%fieldset.builds-feature
.form-group.append-bottom-default.js-secret-runner-token
= f.label :runners_token, _("Runner token"), class: 'label-bold'
.form-control.js-secret-value-placeholder
= '*' * 20
= f.text_field :runners_token, class: "form-control hide js-secret-value", placeholder: 'xEeFCaDAB89'
%p.form-text.text-muted= _("The secure token used by the Runner to checkout the project")
%button.btn.btn-info.prepend-top-10.js-secret-value-reveal-button{ type: 'button', data: { secret_reveal_status: 'false' } }
= _('Reveal value')
%hr
.form-group
%h5.prepend-top-0
= _("Git strategy for pipelines")
......
......@@ -12,7 +12,7 @@
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? _('Collapse') : _('Expand')
%p
= _("Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report.")
= _("Customize your pipeline configuration, view your pipeline status and coverage report.")
.settings-content
= render 'form'
......
---
title: Simplify runner registration token resetting
merge_request: 21658
author:
type: changed
......@@ -107,7 +107,7 @@ namespace :admin do
resource :application_settings, only: [:show, :update] do
resources :services, only: [:index, :edit, :update]
get :usage_data
put :reset_runners_token
put :reset_registration_token
put :reset_health_check_token
put :clear_repository_check_states
get :integrations, :repository, :templates, :ci_cd, :reporting, :metrics_and_profiling, :network, :geo, :preferences
......
......@@ -27,7 +27,9 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
as: :group,
constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do
namespace :settings do
resource :ci_cd, only: [:show], controller: 'ci_cd'
resource :ci_cd, only: [:show], controller: 'ci_cd' do
put :reset_registration_token
end
end
resource :variables, only: [:show, :update]
......
......@@ -437,6 +437,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :members, to: redirect("%{namespace_id}/%{project_id}/project_members")
resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do
post :reset_cache
put :reset_registration_token
end
resource :integrations, only: [:show]
resource :repository, only: [:show], controller: :repository do
......
......@@ -480,7 +480,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -420,7 +420,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "Zugriff auf fehlerhafte Speicher wurde vorübergehend deaktiviert, um die Wiederherstellung zu ermöglichen. Für den zukünftigen Zugriff, behebe bitte das Problem und setze danach die Speicherinformationen zurück."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr "Accès à « %{classification_label} » non autorisé"
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "L’accès aux stockages défaillants a été temporairement désactivé pour permettre la récupération du montage. Réinitialisez les informations de stockage quand le problème sera résolu pour permettre à nouveau l’accès."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr "Accédez à votre jeton d’exécuteur, personnalisez la configuration de votre pipeline et affichez l’état de votre pipeline et le rapport de couverture."
msgid "Account"
......
......@@ -317,9 +317,6 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgstr ""
msgid "Account"
msgstr ""
......@@ -2090,6 +2087,9 @@ msgstr ""
msgid "Customize how Google Code email addresses and usernames are imported into GitLab. In the next step, you'll be able to select the projects you want to import."
msgstr ""
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Cycle Analytics"
msgstr ""
......@@ -5986,9 +5986,6 @@ msgstr ""
msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request."
msgstr ""
msgid "The secure token used by the Runner to checkout the project"
msgstr ""
msgid "The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time."
msgstr ""
......@@ -6950,9 +6947,6 @@ msgstr ""
msgid "You can only edit files when you are on a branch"
msgstr ""
msgid "You can reset runners registration token by pressing a button below."
msgstr ""
msgid "You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}"
msgstr ""
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -420,7 +420,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -330,7 +330,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "L'accesso agli storages è stato temporaneamente disabilitato per consentire il mount di ripristino. Resetta le info d'archiviazione dopo che l'issue è stato risolto per consentire nuovamente l'accesso."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -330,7 +330,7 @@ msgstr "'%{classification_label}'へのアクセスは許可されていませ
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "mount によって復旧できるように、失敗が発生しているストレージへのアクセスを一時的に抑止しました。再度アクセスするためには、問題を解決してからストレージ情報をリセットしてください。"
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr "Runner トークンにアクセスし、パイプラインの設定をカスタマイズ、そしてパイプラインの状態とカバレッジレポートを閲覧します。"
msgid "Account"
......
......@@ -330,7 +330,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "오동작중인 저장공간에 대한 접근이 복구 작업을 위해 마운트할 수 있도록 임시로 허용되었습니다. 문제가 해결된 후 다시 접근을 허용할 수 있게 저장공간 정보를 리셋 해주세요."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -420,7 +420,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr "Acesso a '%{classification_label}' não permitido"
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "Os acessos à storages com defeito foram temporariamente desabilitados para permitir a sua remontagem. Redefina as informações de armazenamento depois que o problema foi resolvido para permitir o acesso de novo."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr "Acesse seu runner token, personalize sua configuração de pipeline e visualize o status do seu pipeline e o relatório de coverage."
msgid "Account"
......
......@@ -390,7 +390,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -420,7 +420,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "Доступ к вышедшим из строя хранилищам временно отключен для возможности монтирования в целях восстановления. Сбросьте информацию о хранилищах после устранения проблемы, чтобы разрешить доступ."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -360,7 +360,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr ""
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -420,7 +420,7 @@ msgstr "Доступ до \"%{classification_label}\" заборонено"
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "Доступ до сховищ, що вийшли з ладу, тимчасово прибраний задля відновлення монтування. Після вирішення проблеми обнуліть інформацію сховища для відновлення доступу."
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr "Отримайте доступ до Gitlab Runner токену, налаштуйте конфігурацію конвеєра та перегляньте його статус, а також звіт про покриття."
msgid "Account"
......
......@@ -330,7 +330,7 @@ msgstr "不允许访问%{classification_label}"
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "为方便修复挂载问题,访问故障存储已被暂时禁用。在问题解决后请重置存储运行状况信息,以允许再次访问。"
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr "访问您的 runner 令牌,自定义流水线配置,以及查看流水线状态和覆盖率报告。"
msgid "Account"
......
......@@ -330,7 +330,7 @@ msgstr ""
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "因恢復安裝,訪問故障存儲已被暫時禁用。在問題解決後將重置存儲信息,以便再次訪問。"
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr ""
msgid "Account"
......
......@@ -330,7 +330,7 @@ msgstr "不允許存取「%{classification_label}」"
msgid "Access to failing storages has been temporarily disabled to allow the mount to recover. Reset storage information after the issue has been resolved to allow access again."
msgstr "已暫時停用失敗的 Git 儲存空間。當儲存空間恢復正常後,請重置儲存空間健康指數。"
msgid "Access your runner token, customize your pipeline configuration, and view your pipeline status and coverage report."
msgid "Customize your pipeline configuration, view your pipeline status and coverage report."
msgstr "存取您執行器憑證,自定義您的流水線配置,並查看你的流水現狀態及測試涵蓋率報告。"
msgid "Account"
......
......@@ -86,4 +86,22 @@ describe Admin::ApplicationSettingsController do
expect(ApplicationSetting.current.receive_max_input_size).to eq(1024)
end
end
describe 'PUT #reset_registration_token' do
before do
sign_in(admin)
end
subject { put :reset_registration_token }
it 'resets runner registration token' do
expect { subject }.to change { ApplicationSetting.current.runners_registration_token }
end
it 'redirects the user to admin runners page' do
subject
expect(response).to redirect_to(admin_runners_path)
end
end
end
......@@ -17,4 +17,18 @@ describe Groups::Settings::CiCdController do
expect(response).to render_template(:show)
end
end
describe 'PUT #reset_registration_token' do
subject { put :reset_registration_token, group_id: group }
it 'resets runner registration token' do
expect { subject }.to change { group.reload.runners_token }
end
it 'redirects the user to admin runners page' do
subject
expect(response).to redirect_to(group_settings_ci_cd_path)
end
end
end
......@@ -74,6 +74,19 @@ describe Projects::Settings::CiCdController do
end
end
describe 'PUT #reset_registration_token' do
subject { put :reset_registration_token, namespace_id: project.namespace, project_id: project }
it 'resets runner registration token' do
expect { subject }.to change { project.reload.runners_token }
end
it 'redirects the user to admin runners page' do
subject
expect(response).to redirect_to(namespace_project_settings_ci_cd_path)
end
end
describe 'PATCH update' do
let(:params) { { ci_config_path: '' } }
......
# frozen_string_literal: true
require 'spec_helper'
describe 'Group CI/CD settings' do
include WaitForRequests
let(:user) {create(:user)}
let(:group) {create(:group)}
before do
group.add_owner(user)
sign_in(user)
end
describe 'runners registration token' do
let!(:token) { group.runners_token }
before do
visit group_settings_ci_cd_path(group)
end
it 'has a registration token' do
expect(page.find('#registration_token')).to have_content(token)
end
describe 'reload registration token' do
let(:page_token) { find('#registration_token').text }
before do
click_button 'Reset runners registration token'
end
it 'changes registration token' do
expect(page_token).not_to eq token
end
end
end
end
......@@ -137,5 +137,29 @@ describe "Projects > Settings > Pipelines settings" do
end
end
end
describe 'runners registration token' do
let!(:token) { project.runners_token }
before do
visit project_settings_ci_cd_path(project)
end
it 'has a registration token' do
expect(page.find('#registration_token')).to have_content(token)
end
describe 'reload registration token' do
let(:page_token) { find('#registration_token').text }
before do
click_button 'Reset runners registration token'
end
it 'changes registration token' do
expect(page_token).not_to eq token
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment