From 8a2e7195d3cad7ce20109cdb344af67854acbda5 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 30 Apr 2015 10:53:59 -0400 Subject: [PATCH 1/7] Use FindBugs plugin 3.0.1. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1fc7209a4..a17b955f4 100644 --- a/pom.xml +++ b/pom.xml @@ -154,7 +154,7 @@ org.codehaus.mojo findbugs-maven-plugin - 3.0.0 + 3.0.1 From 3e31dde570507c06f85acfda6f71d241f56155f6 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 1 May 2015 07:50:18 -0400 Subject: [PATCH 2/7] File.toURL is deprecated. Might manifest as this plugin not working at all in some $JENKINS_HOME paths. --- .../plugins/workflow/cps/global/GroovyShellDecoratorImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/GroovyShellDecoratorImpl.java b/cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/GroovyShellDecoratorImpl.java index 8de6f11cd..e51a74e9e 100644 --- a/cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/GroovyShellDecoratorImpl.java +++ b/cps-global-lib/src/main/java/org/jenkinsci/plugins/workflow/cps/global/GroovyShellDecoratorImpl.java @@ -23,7 +23,7 @@ public class GroovyShellDecoratorImpl extends GroovyShellDecorator { @Override public void configureShell(CpsFlowExecution context, GroovyShell shell) { try { - shell.getClassLoader().addURL(new File(repo.workspace,"src").toURL()); + shell.getClassLoader().addURL(new File(repo.workspace,"src").toURI().toURL()); } catch (MalformedURLException e) { throw new AssertionError(e); } From 94e2e853c64290442351278c9755110222925a1f Mon Sep 17 00:00:00 2001 From: rpocase Date: Fri, 1 May 2015 10:27:00 -0500 Subject: [PATCH 3/7] Updating CpsScmFlowDefinition to respect hudson.slaves.WorkspaceList --- .../plugins/workflow/cps/CpsScmFlowDefinition.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java index 5d08818e5..82888adc9 100644 --- a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java +++ b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java @@ -40,6 +40,7 @@ import java.io.IOException; import java.util.Collection; import java.util.List; +import java.util.Properties; import javax.inject.Inject; import jenkins.model.Jenkins; import org.jenkinsci.plugins.workflow.cps.persistence.PersistIn; @@ -91,7 +92,7 @@ public String getScriptPath() { if (baseWorkspace == null) { throw new IOException(node.getDisplayName() + " may be offline"); } - dir = baseWorkspace.withSuffix("@script"); + dir = getFilePathWithSuffix(baseWorkspace); } else { // should not happen, but just in case: dir = new FilePath(owner.getRootDir()); } @@ -119,6 +120,14 @@ public String getScriptPath() { return exec; } + private FilePath getFilePathWithSuffix(FilePath baseWorkspace) { + return baseWorkspace.withSuffix(getFilePathSuffix()); + } + + private String getFilePathSuffix() { + return new Properties().getProperty("hudson.slaves.WorkspaceList"); + } + @Extension public static class DescriptorImpl extends FlowDefinitionDescriptor { @Inject public Snippetizer snippetizer; From b6dbc5bf3dec81c11673c7807e07e43f00509e11 Mon Sep 17 00:00:00 2001 From: rpocase Date: Fri, 1 May 2015 13:47:54 -0500 Subject: [PATCH 4/7] Adding null and empty string check for hudson.slaves.WorkspaceList to allow "@" to be the default path suffix in concurrent workspace directories --- .../plugins/workflow/cps/CpsScmFlowDefinition.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java index 82888adc9..2e70d831d 100644 --- a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java +++ b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java @@ -125,7 +125,11 @@ private FilePath getFilePathWithSuffix(FilePath baseWorkspace) { } private String getFilePathSuffix() { - return new Properties().getProperty("hudson.slaves.WorkspaceList"); + String defined_suffix = new Properties().getProperty("hudson.slaves.WorkspaceList"); + if (defined_suffix == null || defined_suffix.equals("")) { + defined_suffix = "@"; + } + return defined_suffix; } @Extension public static class DescriptorImpl extends FlowDefinitionDescriptor { From 4701b4a5198e7fd92ba3cbcfea83345513467048 Mon Sep 17 00:00:00 2001 From: rpocase Date: Fri, 1 May 2015 14:11:27 -0500 Subject: [PATCH 5/7] Adding missing "script" portion of concurrent directory suffix --- .../jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java index 2e70d831d..6b5a62de3 100644 --- a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java +++ b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java @@ -121,7 +121,7 @@ public String getScriptPath() { } private FilePath getFilePathWithSuffix(FilePath baseWorkspace) { - return baseWorkspace.withSuffix(getFilePathSuffix()); + return baseWorkspace.withSuffix(getFilePathSuffix() + "script"); } private String getFilePathSuffix() { From b041852d6a5f691ca91f0d52a0c2724958ff7d9b Mon Sep 17 00:00:00 2001 From: rpocase Date: Fri, 1 May 2015 14:22:39 -0500 Subject: [PATCH 6/7] Replacing getFilePathSuffix() return with duplicate of WorkspaceList.COMBINATOR --- .../plugins/workflow/cps/CpsScmFlowDefinition.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java index 6b5a62de3..6e9272246 100644 --- a/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java +++ b/cps/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java @@ -125,11 +125,7 @@ private FilePath getFilePathWithSuffix(FilePath baseWorkspace) { } private String getFilePathSuffix() { - String defined_suffix = new Properties().getProperty("hudson.slaves.WorkspaceList"); - if (defined_suffix == null || defined_suffix.equals("")) { - defined_suffix = "@"; - } - return defined_suffix; + return System.getProperty(WorkspaceList.class.getName(), "@"); } @Extension public static class DescriptorImpl extends FlowDefinitionDescriptor { From 408efbcfbc2f8603c23219321bb6ddbafb0117f6 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Fri, 1 May 2015 17:40:02 -0400 Subject: [PATCH 7/7] [FIXED JENKINS-28179] Noting merge of #124. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 897fb5d2d..70f59e2f5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ Only noting significant user-visible or major API changes, not internal code cle ## 1.6 (upcoming) +* [JENKINS-28179](https://issues.jenkins-ci.org/browse/JENKINS-28179): honor `-Dhudson.slaves.WorkspaceList=` * [JENKINS-27571](https://issues.jenkins-ci.org/browse/JENKINS-27571) Fixed link in build sidepanel. * API addition: `LauncherDecorator` can now be used in block-scoped steps, and there is more flexibility in handling exits from durable tasks.