Skip to content
Permalink
Browse files

Do not display the value of secure environment variable in templates …

…view. (#2647) (#2652)
  • Loading branch information...
varshavaradarajan authored and zabil committed Sep 7, 2016
1 parent 197480d commit 1f2a189208714a6f57e73b10c49416448b6dd4ed
@@ -84,7 +84,7 @@
<%= environment_variable.getName() %>
</td>
<td class="name_value_cell">
<%= environment_variable.getValue() %>
<%= environment_variable.getDisplayValue() %>
</td>
</tr>
<% end %>
@@ -1,5 +1,5 @@
##########################GO-LICENSE-START################################
# Copyright 2014 ThoughtWorks, Inc.
# Copyright 2016 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -134,6 +134,34 @@
end
end

it 'should mask the value of secure environment variable for a stage' do
stage = StageConfigMother.stage_config("stage1")
environment_variable_config_new = EnvironmentVariableConfig.new("env2", "value2")
environment_variable_config_new.setIsSecure(true)
stage.setVariables(EnvironmentVariablesConfig.new([EnvironmentVariableConfig.new("env1", "value1"), environment_variable_config_new]))
template = PipelineTemplateConfigMother.create_template("t1", [stage].to_java(StageConfig))
assign(:template_config, template)
render
Capybara.string(response.body).find("#definition_view_stage_1").tap do |stage|
stage.find(".tab-content #environment_variables_stage_1.tab-pane.active table.variables").tap do |table|
table.find("thead").tap do |head|
head.find("tr").tap do |row|
expect(row).to have_selector("th", :text => "Name")
expect(row).to have_selector("th", :text => "Value")
end
end
table.find("tbody").tap do |body|
body.all("tr").tap do |rows|
expect(rows[0]).to have_selector("td.name_value_cell", :text => "env1")
expect(rows[0]).to have_selector("td.name_value_cell", :text => "value1")
expect(rows[1]).to have_selector("td.name_value_cell", :text => "env2")
expect(rows[1]).to have_selector("td.name_value_cell", :text => "****")
end
end
end
end
end

it "should not show environment variables table if none are configured" do
template = PipelineTemplateConfigMother.create_template("t1")
assign(:template_config, template)

0 comments on commit 1f2a189

Please sign in to comment.
You can’t perform that action at this time.