|
@@ -103,11 +103,12 @@ public boolean isLightweight() { |
|
|
throw new IOException("can only check out SCM into a Run"); |
|
|
} |
|
|
Run<?,?> build = (Run<?,?>) _build; |
|
|
String expandedScriptPath = build.getEnvironment(listener).expand(scriptPath); |
|
|
if (isLightweight()) { |
|
|
try (SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm)) { |
|
|
if (fs != null) { |
|
|
String script = fs.child(scriptPath).contentAsString(); |
|
|
listener.getLogger().println("Obtained " + scriptPath + " from " + scm.getKey()); |
|
|
String script = fs.child(expandedScriptPath).contentAsString(); |
|
|
listener.getLogger().println("Obtained " + expandedScriptPath + " from " + scm.getKey()); |
|
|
Queue.Executable exec = owner.getExecutable(); |
|
|
FlowDurabilityHint hint = (exec instanceof Item) ? DurabilityHintProvider.suggestedFor((Item)exec) : GlobalDefaultFlowDurabilityLevel.getDefaultDurabilityHint(); |
|
|
return new CpsFlowExecution(script, true, owner, hint); |
|
@@ -127,7 +128,7 @@ public boolean isLightweight() { |
|
|
} else { // should not happen, but just in case: |
|
|
dir = new FilePath(owner.getRootDir()); |
|
|
} |
|
|
listener.getLogger().println("Checking out " + scm.getKey() + " into " + dir + " to read " + scriptPath); |
|
|
listener.getLogger().println("Checking out " + scm.getKey() + " into " + dir + " to read " + expandedScriptPath); |
|
|
String script = null; |
|
|
Computer computer = node.toComputer(); |
|
|
if (computer == null) { |
|
@@ -161,8 +162,8 @@ public boolean isLightweight() { |
|
|
listener.getLogger().println("Retrying after 10 seconds"); |
|
|
Thread.sleep(10000); |
|
|
} |
|
|
|
|
|
FilePath scriptFile = dir.child(scriptPath); |
|
|
|
|
|
FilePath scriptFile = dir.child(expandedScriptPath); |
|
|
if (!scriptFile.absolutize().getRemote().replace('\\', '/').startsWith(dir.absolutize().getRemote().replace('\\', '/') + '/')) { // TODO JENKINS-26838 |
|
|
throw new IOException(scriptFile + " is not inside " + dir); |
|
|
} |
|
|