下面列出了hudson.model.Describable#hudson.util.DescribableList 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private MultiBranchProject mockMbp(String credentialId, User user) {
MultiBranchProject mbp = mock(MultiBranchProject.class);
when(mbp.getName()).thenReturn("pipeline1");
when(mbp.getParent()).thenReturn(j.jenkins);
BitbucketSCMSource scmSource = mock(BitbucketSCMSource.class);
when(scmSource.getServerUrl()).thenReturn(apiUrl);
when(scmSource.getCredentialsId()).thenReturn(credentialId);
when(scmSource.getRepoOwner()).thenReturn(USER_UUID);
when(scmSource.getRepository()).thenReturn("demo1");
when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
//mock blueocean credential provider stuff
BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor> properties = new DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor>(mbp);
properties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(
user.getId(), credentialId,
BlueOceanCredentialsProvider.createDomain(apiUrl)
));
Domain domain = mock(Domain.class);
when(domain.getName()).thenReturn(BitbucketCloudScm.DOMAIN_NAME);
when(folderProperty.getDomain()).thenReturn(domain);
when(mbp.getProperties()).thenReturn(properties);
return mbp;
}
private MultiBranchProject mockMbp(String credentialId, User user) {
MultiBranchProject mbp = mock(MultiBranchProject.class);
when(mbp.getName()).thenReturn("pipeline1");
when(mbp.getParent()).thenReturn(j.jenkins);
BitbucketSCMSource scmSource = mock(BitbucketSCMSource.class);
when(scmSource.getServerUrl()).thenReturn(apiUrl);
when(scmSource.getCredentialsId()).thenReturn(credentialId);
when(scmSource.getRepoOwner()).thenReturn("TESTP");
when(scmSource.getRepository()).thenReturn("pipeline-demo-test");
when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
//mock blueocean credential provider stuff
BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor> properties = new DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor>(mbp);
properties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(
user.getId(), credentialId,
BlueOceanCredentialsProvider.createDomain(apiUrl)
));
Domain domain = mock(Domain.class);
when(domain.getName()).thenReturn(BitbucketServerScm.DOMAIN_NAME);
when(folderProperty.getDomain()).thenReturn(domain);
when(mbp.getProperties()).thenReturn(properties);
return mbp;
}
@Test
public void changeSetEntryIsNotGithub() throws Exception {
MultiBranchProject project = mock(MultiBranchProject.class);
Job job = mock(MockJob.class);
Run run = mock(Run.class);
ChangeLogSet logSet = mock(ChangeLogSet.class);
ChangeLogSet.Entry entry = mock(ChangeLogSet.Entry.class);
when(project.getProperties()).thenReturn(new DescribableList(project));
when(entry.getParent()).thenReturn(logSet);
when(logSet.getRun()).thenReturn(run);
when(run.getParent()).thenReturn(job);
when(job.getParent()).thenReturn(project);
when(entry.getMsg()).thenReturn("Closed #123 #124");
when(project.getSCMSources()).thenReturn(Lists.newArrayList(new GitSCMSource("http://example.com/repo.git")));
Collection<BlueIssue> resolved = BlueIssueFactory.resolve(entry);
Assert.assertEquals(0, resolved.size());
}
@Test
public void changeSetJobParentNotMultibranch() throws Exception {
AbstractFolder project = mock(AbstractFolder.class);
Job job = mock(MockJob.class);
Run run = mock(Run.class);
ChangeLogSet logSet = mock(ChangeLogSet.class);
ChangeLogSet.Entry entry = mock(ChangeLogSet.Entry.class);
when(project.getProperties()).thenReturn(new DescribableList(project));
when(entry.getParent()).thenReturn(logSet);
when(logSet.getRun()).thenReturn(run);
when(run.getParent()).thenReturn(job);
when(job.getParent()).thenReturn(project);
when(entry.getMsg()).thenReturn("Closed #123 #124");
Collection<BlueIssue> resolved = BlueIssueFactory.resolve(entry);
Assert.assertEquals(0, resolved.size());
}
protected MultiBranchProject mockMbp(String credentialId,User user, String credentialDomainName){
MultiBranchProject mbp = mock(MultiBranchProject.class);
when(mbp.getName()).thenReturn("PR-demo");
when(mbp.getParent()).thenReturn(j.jenkins);
GitHubSCMSource scmSource = mock(GitHubSCMSource.class);
when(scmSource.getApiUri()).thenReturn(githubApiUrl);
when(scmSource.getCredentialsId()).thenReturn(credentialId);
when(scmSource.getRepoOwner()).thenReturn("cloudbeers");
when(scmSource.getRepository()).thenReturn("PR-demo");
when(mbp.getSCMSources()).thenReturn(Lists.<SCMSource>newArrayList(scmSource));
BlueOceanCredentialsProvider.FolderPropertyImpl folderProperty = mock(BlueOceanCredentialsProvider.FolderPropertyImpl.class);
DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor> mbpProperties = new DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor>(mbp);
mbpProperties.add(new BlueOceanCredentialsProvider.FolderPropertyImpl(
user.getId(), credentialId,
BlueOceanCredentialsProvider.createDomain(githubApiUrl)
));
Domain domain = mock(Domain.class);
when(domain.getName()).thenReturn(credentialDomainName);
when(folderProperty.getDomain()).thenReturn(domain);
when(mbp.getProperties()).thenReturn(mbpProperties);
return mbp;
}
@Test
public void resolverShouldCorrectlyMerge() {
final DescribableList firstFolderProperties = mock(DescribableList.class);
when(firstFolderProperties.get(FolderVaultConfiguration.class))
.thenReturn(completeTestConfigFolder("firstParent", null));
final DescribableList secondFolderProperties = mock(DescribableList.class);
when(secondFolderProperties.get(FolderVaultConfiguration.class))
.thenReturn(completeTestConfigFolder("secondParent", 2));
final AbstractFolder secondParent = generateMockFolder(secondFolderProperties, null);
final AbstractFolder firstParent = generateMockFolder(firstFolderProperties, secondParent);
final Job job = generateMockJob(firstParent);
VaultConfiguration result = new FolderVaultConfiguration.ForJob().forJob(job);
VaultConfiguration expected = completeTestConfig("firstParent", null)
.mergeWithParent(completeTestConfig("secondParent", 2));
assertThat(result.getVaultCredentialId(), is(expected.getVaultCredentialId()));
assertThat(result.getVaultUrl(), is(expected.getVaultUrl()));
assertThat(result.getEngineVersion(), is(expected.getEngineVersion()));
}
public void createGlobalEnvironmentVariables(String key, String value){
Jenkins instance = Jenkins.getInstance();
DescribableList<NodeProperty<?>, NodePropertyDescriptor> globalNodeProperties = instance.getGlobalNodeProperties();
List<EnvironmentVariablesNodeProperty> envVarsNodePropertyList = globalNodeProperties.getAll(EnvironmentVariablesNodeProperty.class);
EnvironmentVariablesNodeProperty newEnvVarsNodeProperty = null;
EnvVars envVars = null;
if ( envVarsNodePropertyList == null || envVarsNodePropertyList.size() == 0 ) {
newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty();
globalNodeProperties.add(newEnvVarsNodeProperty);
envVars = newEnvVarsNodeProperty.getEnvVars();
} else {
envVars = envVarsNodePropertyList.get(0).getEnvVars();
}
envVars.put(key, value);
try {
instance.save();
} catch(Exception e) {
System.out.println("Failed to create env variable");
}
}
@Before
public void configureCloud() throws Exception {
cloud = setupCloud(this, name);
createSecret(cloud.connect(), cloud.getNamespace());
cloud.getTemplates().clear();
cloud.addTemplate(buildBusyboxTemplate("busybox"));
setupHost();
r.jenkins.clouds.add(cloud);
DescribableList<NodeProperty<?>, NodePropertyDescriptor> list = r.jenkins.getGlobalNodeProperties();
EnvironmentVariablesNodeProperty newEnvVarsNodeProperty = new hudson.slaves.EnvironmentVariablesNodeProperty();
list.add(newEnvVarsNodeProperty);
EnvVars envVars = newEnvVarsNodeProperty.getEnvVars();
envVars.put("GLOBAL", "GLOBAL");
envVars.put("JAVA_HOME_X", "java-home-x");
r.jenkins.save();
}
@Override
public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo) {
if (fromDBObject == null) return null;
BasicDBList rawList = (BasicDBList) fromDBObject;
List list = new ArrayList();
for (Object obj : rawList) {
DBObject dbObj = (DBObject) obj;
list.add(getMapper().fromDBObject(optionalExtraInfo.getSubClass(), dbObj, getMapper().createEntityCache()));
}
Saveable owner = null; // TODO figure out how to associate the deserialized project here
return new DescribableList(owner, list);
}
/**
* Creates a freestyle job from a YAML file and verifies that issue recorder finds warnings.
*/
@Test
public void shouldCreateFreestyleJobUsingJobDslAndVerifyIssueRecorderWithDefaultConfiguration() {
configureJenkins("job-dsl-warnings-ng-default.yaml");
TopLevelItem project = getJenkins().jenkins.getItem("dsl-freestyle-job");
assertThat(project).isNotNull();
assertThat(project).isInstanceOf(FreeStyleProject.class);
DescribableList<Publisher, Descriptor<Publisher>> publishers = ((FreeStyleProject) project).getPublishersList();
assertThat(publishers).hasSize(1);
Publisher publisher = publishers.get(0);
assertThat(publisher).isInstanceOf(IssuesRecorder.class);
HealthReport healthReport = ((FreeStyleProject) project).getBuildHealth();
assertThat(healthReport.getScore()).isEqualTo(100);
IssuesRecorder recorder = (IssuesRecorder) publisher;
assertThat(recorder.getAggregatingResults()).isFalse();
assertThat(recorder.getTrendChartType()).isEqualTo(TrendChartType.AGGREGATION_TOOLS);
assertThat(recorder.getBlameDisabled()).isFalse();
assertThat(recorder.getForensicsDisabled()).isFalse();
assertThat(recorder.getEnabledForFailure()).isFalse();
assertThat(recorder.getHealthy()).isEqualTo(0);
assertThat(recorder.getId()).isNull();
assertThat(recorder.getIgnoreFailedBuilds()).isTrue();
assertThat(recorder.getIgnoreQualityGate()).isFalse();
assertThat(recorder.getMinimumSeverity()).isEqualTo("LOW");
assertThat(recorder.getName()).isNull();
assertThat(recorder.getQualityGates()).hasSize(0);
assertThat(recorder.getSourceCodeEncoding()).isEmpty();
assertThat(recorder.getUnhealthy()).isEqualTo(0);
List<Tool> tools = recorder.getTools();
assertThat(tools).hasSize(2);
assertThat(tools.get(0)).isInstanceOf(Java.class);
}
/**
* Returns the issue recorder instance for the specified job.
*
* @param job
* the job to get the recorder for
*
* @return the issue recorder
*/
protected IssuesRecorder getRecorder(final AbstractProject<?, ?> job) {
DescribableList<Publisher, Descriptor<Publisher>> publishers = job.getPublishersList();
for (Publisher publisher : publishers) {
if (publisher instanceof IssuesRecorder) {
return (IssuesRecorder) publisher;
}
}
throw new AssertionError("No instance of IssuesRecorder found for job " + job);
}
protected Attribute createAttribute(String name, final TypePair type) {
boolean multiple =
type.rawType.isArray()
|| Collection.class.isAssignableFrom(type.rawType);
// If attribute is a Collection|Array of T, we need to introspect further to determine T
Class c = multiple ? getComponentType(type) : type.rawType;
if (c == null) {
throw new IllegalStateException("Unable to detect type of attribute " + getTarget() + '#' + name);
}
// special collection types with dedicated handlers to manage data replacement / possible values
if (DescribableList.class.isAssignableFrom(type.rawType)) {
return new DescribableListAttribute(name, c);
} else if (PersistedList.class.isAssignableFrom(type.rawType)) {
return new PersistedListAttribute(name, c);
}
Attribute attribute;
if (!c.isPrimitive() && !c.isEnum() && Modifier.isAbstract(c.getModifiers())) {
if (!Describable.class.isAssignableFrom(c)) {
// Not a Describable, so we don't know how to detect concrete implementation type
LOGGER.warning("Can't handle "+getTarget()+"#"+name+": type is abstract but not Describable.");
return null;
}
attribute = new DescribableAttribute(name, c);
} else {
attribute = new Attribute(name, c);
}
attribute.multiple(multiple);
return attribute;
}
@Test
public void configure() throws Exception {
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());
}
@Test
@Issue("Issue #173")
@ConfiguredWithCode("SetEnvironmentVariable.yml")
public void shouldSetEnvironmentVariable() throws Exception {
final DescribableList<NodeProperty<?>, NodePropertyDescriptor> properties = Jenkins.get().getNodeProperties();
EnvVars env = new EnvVars();
for (NodeProperty<?> property : properties) {
property.buildEnvVars(env, TaskListener.NULL);
}
assertEquals("BAR", env.get("FOO"));
}
@Test
@ConfiguredWithCode("ConfigureLabels.yml")
public void shouldExportLabelAtoms() throws Exception {
DescribableList properties = Jenkins.get().getLabelAtom("label1").getProperties();
properties.add(new TestProperty(1));
final ByteArrayOutputStream out = new ByteArrayOutputStream();
ConfigurationAsCode.get().export(out);
final String exported = out.toString();
String content = FileUtils.readFileToString(new File(getClass().getResource("ExpectedLabelsConfiguration.yml").toURI()), "UTF-8");
assertThat(exported, containsString(content));
}
@Test
public void changeSetEntry() throws Exception {
MultiBranchProject project = mock(MultiBranchProject.class);
Job job = mock(MockJob.class);
Run run = mock(Run.class);
ChangeLogSet logSet = mock(ChangeLogSet.class);
ChangeLogSet.Entry entry = mock(ChangeLogSet.Entry.class);
when(project.getProperties()).thenReturn(new DescribableList(project));
when(entry.getParent()).thenReturn(logSet);
when(logSet.getRun()).thenReturn(run);
when(run.getParent()).thenReturn(job);
when(job.getParent()).thenReturn(project);
GitHubSCMSource source = new GitHubSCMSource("foo", null, null, null, "example", "repo");
when(project.getSCMSources()).thenReturn(Lists.newArrayList(source));
when(entry.getMsg()).thenReturn("Closed #123 #124");
Collection<BlueIssue> resolved = BlueIssueFactory.resolve(entry);
Assert.assertEquals(2, resolved.size());
Map<String, BlueIssue> issueMap = Maps.uniqueIndex(resolved, new Function<BlueIssue, String>() {
@Override
public String apply(BlueIssue input) {
return input.getId();
}
});
BlueIssue issue123 = issueMap.get("#123");
Assert.assertEquals("https://github.com/example/repo/issues/123", issue123.getURL());
BlueIssue issue124 = issueMap.get("#124");
Assert.assertEquals("https://github.com/example/repo/issues/124", issue124.getURL());
}
private AbstractFolder generateMockFolder(final DescribableList firstFolderProperties,
final AbstractFolder parentToReturn) {
return new AbstractFolder<TopLevelItem>(null, null) {
@NonNull
@Override
public ItemGroup getParent() {
return parentToReturn;
}
@Override
public DescribableList<AbstractFolderProperty<?>, AbstractFolderPropertyDescriptor> getProperties() {
return firstFolderProperties;
}
};
}
@Test
@LocalData()
public void upgradeFrom_0_10() throws Exception {
List<PodTemplate> templates = cloud.getTemplates();
PodTemplate template = templates.get(0);
DescribableList<NodeProperty<?>,NodePropertyDescriptor> nodeProperties = template.getNodeProperties();
assertEquals(1, nodeProperties.size());
ToolLocationNodeProperty property = (ToolLocationNodeProperty) nodeProperties.get(0);
assertEquals(1, property.getLocations().size());
ToolLocation location = property.getLocations().get(0);
assertEquals("Default", location.getName());
assertEquals("/custom/path", location.getHome());
assertEquals(GitTool.class, location.getType().clazz);
assertEquals(cloud.DEFAULT_WAIT_FOR_POD_SEC, cloud.getWaitForPodSec());
}
private void verifyPublishers(DescribableList<Publisher, Descriptor<Publisher>> publishers) {
assertThat("Should add publisher", publishers, hasSize(2));
assertThat("Should add status publisher", publishers.get(0), instanceOf(GitHubPRBuildStatusPublisher.class));
assertThat("Should add 2 packages",
((GitHubPRBuildStatusPublisher) publishers.get(0)).getStatusMsg().getContent(),
equalTo(JOB_DSL_PUBLISHER_TEXT_CONTENT));
assertThat("Has comment publisher", publishers.get(1), instanceOf(GitHubPRCommentPublisher.class));
GitHubPRCommentPublisher commentPublisher = (GitHubPRCommentPublisher) publishers.get(1);
assertThat("Comment matches", commentPublisher.getComment().getContent(), equalTo("comment"));
assertThat("Only failed builds", commentPublisher.getStatusVerifier().getBuildStatus(), equalTo(Result.FAILURE));
assertThat("Publish marked as failure", commentPublisher.getErrorHandler().getBuildStatus(), equalTo(Result.FAILURE));
}
@Deprecated
public JUnitResultArchiver(
String testResults,
boolean keepLongStdio,
DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers) {
this(testResults, keepLongStdio, testDataPublishers, 1.0);
}
@Deprecated
public JUnitResultArchiver(
String testResults,
boolean keepLongStdio,
DescribableList<TestDataPublisher, Descriptor<TestDataPublisher>> testDataPublishers,
double healthScaleFactor) {
this.testResults = testResults;
setKeepLongStdio(keepLongStdio);
setTestDataPublishers(testDataPublishers == null ? Collections.<TestDataPublisher>emptyList() : testDataPublishers);
setHealthScaleFactor(healthScaleFactor);
setAllowEmptyResults(false);
}
@Override
public Object encode(Object value, MappedField optionalExtraInfo) {
if (value == null) return null;
DescribableList describableList = (DescribableList) value;
BasicDBList convertedList = new BasicDBList();
for (Object obj : describableList.toList()) {
convertedList.add(getMapper().toDBObject(obj));
}
return convertedList;
}
/**
* Creates a freestyle job from a YAML file and verifies that all fields in issue recorder are set correct.
*/
@Test
public void shouldCreateFreestyleJobUsingJobDslAndVerifyIssueRecorderWithValuesSet() {
configureJenkins("job-dsl-warnings-ng.yaml");
TopLevelItem project = getJenkins().jenkins.getItem("dsl-freestyle-job");
assertThat(project).isNotNull();
assertThat(project).isInstanceOf(FreeStyleProject.class);
DescribableList<Publisher, Descriptor<Publisher>> publishers = ((FreeStyleProject) project).getPublishersList();
assertThat(publishers).hasSize(1);
Publisher publisher = publishers.get(0);
assertThat(publisher).isInstanceOf(IssuesRecorder.class);
HealthReport healthReport = ((FreeStyleProject) project).getBuildHealth();
assertThat(healthReport.getScore()).isEqualTo(100);
IssuesRecorder recorder = (IssuesRecorder) publisher;
assertThat(recorder.getAggregatingResults()).isTrue();
assertThat(recorder.getTrendChartType()).isEqualTo(TrendChartType.NONE);
assertThat(recorder.getBlameDisabled()).isTrue();
assertThat(recorder.getForensicsDisabled()).isTrue();
assertThat(recorder.getEnabledForFailure()).isTrue();
assertThat(recorder.getHealthy()).isEqualTo(10);
assertThat(recorder.getId()).isEqualTo("test-id");
assertThat(recorder.getIgnoreFailedBuilds()).isFalse();
assertThat(recorder.getIgnoreQualityGate()).isTrue();
assertThat(recorder.getMinimumSeverity()).isEqualTo("ERROR");
assertThat(recorder.getName()).isEqualTo("test-name");
assertThat(recorder.getSourceCodeEncoding()).isEqualTo("UTF-8");
assertThat(recorder.getUnhealthy()).isEqualTo(50);
assertThat(recorder.getReferenceJobName()).isEqualTo("test-job");
assertThat(recorder.getQualityGates()).hasSize(1);
List<Tool> tools = recorder.getTools();
assertThat(tools).hasSize(2);
assertThat(tools.get(0)).isInstanceOf(Java.class);
}
@Test
public void resolverShouldHandleAbsentConfigurationOnFolders() {
final DescribableList firstFolderProperties = mock(DescribableList.class);
when(firstFolderProperties.get(FolderVaultConfiguration.class))
.thenReturn(completeTestConfigFolder("firstParent"));
final DescribableList secondFolderProperties = mock(DescribableList.class);
when(secondFolderProperties.get(FolderVaultConfiguration.class)).thenReturn(null);
final AbstractFolder secondParent = generateMockFolder(secondFolderProperties, null);
final AbstractFolder firstParent = generateMockFolder(firstFolderProperties, secondParent);
final Job job = generateMockJob(firstParent);
VaultConfiguration result = new FolderVaultConfiguration.ForJob().forJob(job);
VaultConfiguration expected = completeTestConfig("firstParent").mergeWithParent(null);
assertThat(result.getVaultCredentialId(), is(expected.getVaultCredentialId()));
assertThat(result.getVaultUrl(), is(expected.getVaultUrl()));
assertThat(result.getEngineVersion(), is(expected.getEngineVersion()));
}
@DataBoundConstructor
public JiraExtPublisherStep(IssueStrategyExtension issueStrategy, List<JiraOperationExtension> extensions)
{
this.issueStrategy = issueStrategy;
this.extensions = new DescribableList<>(Saveable.NOOP, Util.fixNull(extensions));
}
/**
* All the configured extensions attached to this {@link JiraExtBuildStep}.
*/
public DescribableList<JiraOperationExtension, JiraOperationExtensionDescriptor> getExtensions() {
return extensions;
}
@DataBoundConstructor
public JiraExtBuildStep(IssueStrategyExtension issueStrategy, List<JiraOperationExtension> extensions)
{
this.issueStrategy = issueStrategy;
this.extensions = new DescribableList<>(Saveable.NOOP, Util.fixNull(extensions));
}
/**
* All the configured extensions attached to this {@link JiraExtBuildStep}.
*/
public DescribableList<JiraOperationExtension, JiraOperationExtensionDescriptor> getExtensions() {
return extensions;
}
public PodTemplateToolLocation(DescribableList.Owner owner) {
super(owner);
}
@Override
public boolean start() throws Exception {
LOGGER.log(Level.FINE, "Starting container step.");
String containerName = step.getName();
String shell = step.getShell();
KubernetesNodeContext nodeContext = new KubernetesNodeContext(getContext());
EnvironmentExpander env = getContext().get(EnvironmentExpander.class);
EnvVars globalVars = null;
Jenkins instance = Jenkins.getInstance();
DescribableList<NodeProperty<?>, NodePropertyDescriptor> globalNodeProperties = instance.getGlobalNodeProperties();
List<EnvironmentVariablesNodeProperty> envVarsNodePropertyList = globalNodeProperties
.getAll(EnvironmentVariablesNodeProperty.class);
if (envVarsNodePropertyList != null && envVarsNodePropertyList.size() != 0) {
globalVars = envVarsNodePropertyList.get(0).getEnvVars();
}
EnvVars rcEnvVars = null;
Run run = getContext().get(Run.class);
TaskListener taskListener = getContext().get(TaskListener.class);
if(run!=null && taskListener != null) {
rcEnvVars = run.getEnvironment(taskListener);
}
decorator = new ContainerExecDecorator();
decorator.setNodeContext(nodeContext);
decorator.setContainerName(containerName);
decorator.setEnvironmentExpander(env);
decorator.setWs(getContext().get(FilePath.class));
decorator.setGlobalVars(globalVars);
decorator.setRunContextEnvVars(rcEnvVars);
decorator.setShell(shell);
getContext().newBodyInvoker()
.withContext(BodyInvoker
.mergeLauncherDecorators(getContext().get(LauncherDecorator.class), decorator))
.withCallback(new ContainerExecCallback(decorator))
.start();
return false;
}