Commit 598fa4cd authored by mfluharty's avatar mfluharty

Default masked to false for new variables

Set the default value to false
Adjust tests to expect false as the default
Update documentation to make new default clear
parent d16c11ab
...@@ -17,7 +17,7 @@ module CiVariablesHelper ...@@ -17,7 +17,7 @@ module CiVariablesHelper
if variable && !only_key_value if variable && !only_key_value
variable.masked variable.masked
else else
true false
end end
end end
......
= _('Environment variables are applied to environments via the runner. They can be protected by only exposing them to protected branches or tags. Additionally, they will be masked by default so they are hidden in job logs, though they must match certain regexp requirements to do so. You can use environment variables for passwords, secret keys, or whatever you want.') = _('Environment variables are applied to environments via the runner. They can be protected by only exposing them to protected branches or tags. Additionally, they can be masked so they are hidden in job logs, though they must match certain regexp requirements to do so. You can use environment variables for passwords, secret keys, or whatever you want.')
= _('You may also add variables that are made available to the running application by prepending the variable key with <code>K8S_SECRET_</code>.').html_safe = _('You may also add variables that are made available to the running application by prepending the variable key with <code>K8S_SECRET_</code>.').html_safe
= link_to _('More information'), help_page_path('ci/variables/README', anchor: 'variables') = link_to _('More information'), help_page_path('ci/variables/README', anchor: 'variables')
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- value = variable&.value - value = variable&.value
- is_protected_default = ci_variable_protected_by_default? - is_protected_default = ci_variable_protected_by_default?
- is_protected = ci_variable_protected?(variable, only_key_value) - is_protected = ci_variable_protected?(variable, only_key_value)
- is_masked_default = true - is_masked_default = false
- is_masked = ci_variable_masked?(variable, only_key_value) - is_masked = ci_variable_masked?(variable, only_key_value)
- id_input_name = "#{form_field}[variables_attributes][][id]" - id_input_name = "#{form_field}[variables_attributes][][id]"
......
---
title: Default masked to false for new variables
merge_request: 28186
author:
type: changed
...@@ -86,7 +86,7 @@ Variable types can be set via the [UI](#via-the-ui) or the [API](../../api/proje ...@@ -86,7 +86,7 @@ Variable types can be set via the [UI](#via-the-ui) or the [API](../../api/proje
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/13784) in GitLab 11.10 > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/13784) in GitLab 11.10
By default, variables will be created as masked variables. Variables can be created as masked variables.
This means that the value of the variable will be hidden in job logs, This means that the value of the variable will be hidden in job logs,
though it must match certain requirements to do so: though it must match certain requirements to do so:
......
...@@ -3877,7 +3877,7 @@ msgstr "" ...@@ -3877,7 +3877,7 @@ msgstr ""
msgid "Enter the merge request title" msgid "Enter the merge request title"
msgstr "" msgstr ""
msgid "Environment variables are applied to environments via the runner. They can be protected by only exposing them to protected branches or tags. Additionally, they will be masked by default so they are hidden in job logs, though they must match certain regexp requirements to do so. 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. Additionally, they can be masked so they are hidden in job logs, though they must match certain regexp requirements to do so. 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" msgid "Environment variables are configured by your administrator to be %{link_start}protected%{link_end} by default"
......
...@@ -45,12 +45,12 @@ shared_examples 'variable list' do ...@@ -45,12 +45,12 @@ shared_examples 'variable list' do
end end
end end
it 'defaults to masked' do it 'defaults to unmasked' 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')
find('.js-ci-variable-input-value').set('key_value') find('.js-ci-variable-input-value').set('key_value')
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('true') expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false')
end end
click_button('Save variables') click_button('Save variables')
...@@ -62,7 +62,7 @@ shared_examples 'variable list' do ...@@ -62,7 +62,7 @@ shared_examples 'variable list' do
page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do
expect(find('.js-ci-variable-input-key').value).to eq('key') expect(find('.js-ci-variable-input-key').value).to eq('key')
expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key_value') expect(find('.js-ci-variable-input-value', visible: false).value).to eq('key_value')
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('true') expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false')
end end
end end
...@@ -234,12 +234,14 @@ shared_examples 'variable list' do ...@@ -234,12 +234,14 @@ shared_examples 'variable list' do
end end
it 'edits variable to be unmasked' do it 'edits variable to be unmasked' do
page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do page.within('.js-ci-variable-list-section .js-row:last-child') do
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('true') find('.js-ci-variable-input-key').set('unmasked_key')
find('.js-ci-variable-input-value').set('unmasked_value')
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false')
find('.ci-variable-masked-item .js-project-feature-toggle').click find('.ci-variable-masked-item .js-project-feature-toggle').click
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false') expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('true')
end end
click_button('Save variables') click_button('Save variables')
...@@ -247,12 +249,6 @@ shared_examples 'variable list' do ...@@ -247,12 +249,6 @@ shared_examples 'variable list' do
visit page_path visit page_path
page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false')
end
end
it 'edits variable to be masked' do
page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('true') expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('true')
...@@ -268,6 +264,14 @@ shared_examples 'variable list' do ...@@ -268,6 +264,14 @@ shared_examples 'variable list' do
page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do page.within('.js-ci-variable-list-section .js-row:nth-child(2)') do
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false') expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false')
end
end
it 'edits variable to be masked' do
page.within('.js-ci-variable-list-section .js-row:last-child') do
find('.js-ci-variable-input-key').set('masked_key')
find('.js-ci-variable-input-value').set('masked_value')
expect(find('.js-ci-variable-input-masked', visible: false).value).to eq('false')
find('.ci-variable-masked-item .js-project-feature-toggle').click find('.ci-variable-masked-item .js-project-feature-toggle').click
...@@ -348,10 +352,11 @@ shared_examples 'variable list' do ...@@ -348,10 +352,11 @@ shared_examples 'variable list' do
end end
end end
it 'shows validation error box about empty values' do it 'shows validation error box about masking empty values' 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('empty_value') find('.js-ci-variable-input-key').set('empty_value')
find('.js-ci-variable-input-value').set('') find('.js-ci-variable-input-value').set('')
find('.ci-variable-masked-item .js-project-feature-toggle').click
end end
click_button('Save variables') click_button('Save variables')
...@@ -367,6 +372,7 @@ shared_examples 'variable list' do ...@@ -367,6 +372,7 @@ shared_examples 'variable list' 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('unmaskable_value') find('.js-ci-variable-input-key').set('unmaskable_value')
find('.js-ci-variable-input-value').set('???') find('.js-ci-variable-input-value').set('???')
find('.ci-variable-masked-item .js-project-feature-toggle').click
end end
click_button('Save variables') click_button('Save variables')
......
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