Skip to content
Snippets Groups Projects
Unverified Commit 42af2295 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Simplify runner registration token resetting

This icommit adds several changes related to the same topic
- resetting a Runner registration token:

1. On Project settings page it adds a button for resetting the
   registration token and it removes the Runner token field
   that was confusing all GitLab users.

2. On Group settings page it adds the same button for resetting
   the registration token.

3. On Admin Runners settings page it moves the button to the same
   place as in Project and Group settings and it changes slightly
   the page layout to make it more similar to Group and Project
   setting pages.

4. It refactorizes a little the partial that prints runner
   registration description. Thanks to this Project, Group
   and Admin settings of the Runner are re-using the same
   code to generate the button.

5. Updates the translations of changed text.
parent dfb9ac3a
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -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"
Loading
Loading
Loading
Loading
@@ -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"
Loading
Loading
Loading
Loading
@@ -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"
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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: '' } }
 
Loading
Loading
# 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
Loading
Loading
@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment