use of hudson.slaves.EnvironmentVariablesNodeProperty in project workflow-job-plugin by jenkinsci.
the class WorkflowRunTest method globalNodePropertiesInEnv.
@Test
@Issue("JENKINS-43396")
public void globalNodePropertiesInEnv() throws Exception {
DescribableList<NodeProperty<?>, NodePropertyDescriptor> original = r.jenkins.getGlobalNodeProperties();
EnvironmentVariablesNodeProperty envProp = new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("KEY", "VALUE"));
original.add(envProp);
WorkflowJob j = r.jenkins.createProject(WorkflowJob.class, "envVars");
j.setDefinition(new CpsFlowDefinition("echo \"KEY is ${env.KEY}\"", true));
WorkflowRun b = r.assertBuildStatusSuccess(j.scheduleBuild2(0));
r.assertLogContains("KEY is " + envProp.getEnvVars().get("KEY"), b);
}
use of hudson.slaves.EnvironmentVariablesNodeProperty in project sonar-scanner-jenkins by SonarSource.
the class MsBuildSQRunnerBeginTest method addEnvVar.
private void addEnvVar(String key, String value) {
EnvironmentVariablesNodeProperty prop = new EnvironmentVariablesNodeProperty();
EnvVars envVars = prop.getEnvVars();
envVars.put(key, value);
j.jenkins.getGlobalNodeProperties().add(prop);
}
use of hudson.slaves.EnvironmentVariablesNodeProperty in project configuration-as-code-plugin by jenkinsci.
the class GlobalNodePropertiesTest method configure.
@Test
public void configure() {
final Jenkins jenkins = Jenkins.get();
DescribableList<NodeProperty<?>, NodePropertyDescriptor> nodeProperties = jenkins.getGlobalNodeProperties();
Set<Map.Entry<String, String>> entries = ((EnvironmentVariablesNodeProperty) nodeProperties.get(0)).getEnvVars().entrySet();
assertEquals(1, entries.size());
Map.Entry<String, String> envVar = entries.iterator().next();
assertEquals("FOO", envVar.getKey());
assertEquals("BAR", envVar.getValue());
}
use of hudson.slaves.EnvironmentVariablesNodeProperty in project htmlpublisher-plugin by jenkinsci.
the class HtmlPublisherIntegrationTest method addEnvironmentVariable.
private void addEnvironmentVariable(String key, String value) {
EnvironmentVariablesNodeProperty prop = new EnvironmentVariablesNodeProperty();
EnvVars envVars = prop.getEnvVars();
envVars.put(key, value);
j.jenkins.getGlobalNodeProperties().add(prop);
}
use of hudson.slaves.EnvironmentVariablesNodeProperty in project phabricator-jenkins-plugin by uber.
the class TestUtils method setEnvironmentVariables.
public static void setEnvironmentVariables(JenkinsRule j, Map<String, String> params) throws IOException {
EnvironmentVariablesNodeProperty prop = new EnvironmentVariablesNodeProperty();
EnvVars envVars = prop.getEnvVars();
envVars.putAll(params);
j.jenkins.getGlobalNodeProperties().add(prop);
}
Aggregations