Commit cad0661a authored by Alexis Reigel's avatar Alexis Reigel

callout when ci variables are protected by default

parent a648bcad
- save_endpoint = local_assigns.fetch(:save_endpoint, nil) - save_endpoint = local_assigns.fetch(:save_endpoint, nil)
- if ci_variable_protected_by_default?
%p.settings-message.text-center
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('ci/variables/README', anchor: 'protected-variables') }
= s_('Environment variables are configured by your administrator to be %{link_start}protected%{link_end} by default').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
.row .row
.col-lg-12.js-ci-variable-list-section{ data: { save_endpoint: save_endpoint } } .col-lg-12.js-ci-variable-list-section{ data: { save_endpoint: save_endpoint } }
.hide.alert.alert-danger.js-ci-variable-error-box .hide.alert.alert-danger.js-ci-variable-error-box
......
...@@ -2675,6 +2675,9 @@ msgstr "" ...@@ -2675,6 +2675,9 @@ msgstr ""
msgid "Environment variables are applied to environments via the runner. They can be protected by only exposing them to protected branches or tags. You can use environment variables for passwords, secret keys, or whatever you want." msgid "Environment variables are applied to environments via the runner. They can be protected by only exposing them to protected branches or tags. You can use environment variables for passwords, secret keys, or whatever you want."
msgstr "" msgstr ""
msgid "Environment variables are configured by your administrator to be %{link_start}protected%{link_end} by default"
msgstr ""
msgid "Environments" msgid "Environments"
msgstr "" msgstr ""
......
...@@ -67,11 +67,11 @@ shared_examples 'variable list' do ...@@ -67,11 +67,11 @@ shared_examples 'variable list' do
context 'application setting is true' do context 'application setting is true' do
before do before do
stub_application_setting(protected_ci_variables: true) stub_application_setting(protected_ci_variables: true)
end
it 'defaults to protected' do
visit page_path visit page_path
end
it 'defaults to protected' do
page.within('.js-ci-variable-list-section .js-row:last-child') do page.within('.js-ci-variable-list-section .js-row:last-child') do
find('.js-ci-variable-input-key').set('key') find('.js-ci-variable-input-key').set('key')
end end
...@@ -80,16 +80,20 @@ shared_examples 'variable list' do ...@@ -80,16 +80,20 @@ shared_examples 'variable list' do
expect(values).to eq %w(false true true) expect(values).to eq %w(false true true)
end end
it 'shows a message regarding the changed default' do
expect(page).to have_content 'Environment variables are configured by your administrator to be protected by default'
end
end end
context 'application setting is false' do context 'application setting is false' do
before do before do
stub_application_setting(protected_ci_variables: false) stub_application_setting(protected_ci_variables: false)
end
it 'defaults to unprotected' do
visit page_path visit page_path
end
it 'defaults to unprotected' do
page.within('.js-ci-variable-list-section .js-row:last-child') do page.within('.js-ci-variable-list-section .js-row:last-child') do
find('.js-ci-variable-input-key').set('key') find('.js-ci-variable-input-key').set('key')
end end
...@@ -98,6 +102,10 @@ shared_examples 'variable list' do ...@@ -98,6 +102,10 @@ shared_examples 'variable list' do
expect(values).to eq %w(false false false) expect(values).to eq %w(false false false)
end end
it 'does not show a message regarding the default' do
expect(page).not_to have_content 'Environment variables are configured by your administrator to be protected by default'
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