diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
new file mode 100644
index 00000000..510f24fb
--- /dev/null
+++ b/.mvn/extensions.xml
@@ -0,0 +1,7 @@
+
+
+ io.jenkins.tools.incrementals
+ git-changelist-maven-extension
+ 1.0-beta-3
+
+
diff --git a/.mvn/maven.config b/.mvn/maven.config
new file mode 100644
index 00000000..2a0299c4
--- /dev/null
+++ b/.mvn/maven.config
@@ -0,0 +1,2 @@
+-Pconsume-incrementals
+-Pmight-produce-incrementals
diff --git a/Jenkinsfile b/Jenkinsfile
index a7a037f9..a229fa51 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1 +1 @@
-buildPlugin(jenkinsVersions: [null, '2.32.3'])
+buildPlugin()
diff --git a/pom.xml b/pom.xml
index b0746166..deebf90a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,12 +28,12 @@
org.jenkins-ci.plugins
plugin
- 3.2
+ 3.15
org.jenkins-ci.plugins.workflow
workflow-basic-steps
- 2.9-SNAPSHOT
+ ${revision}${changelist}
hpi
Pipeline: Basic Steps
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Basic+Steps+Plugin
@@ -47,7 +47,7 @@
scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git
scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git
https://github.com/jenkinsci/${project.artifactId}-plugin
- HEAD
+ ${scmTag}
@@ -62,11 +62,15 @@
- 2.7.3
- 7
- 2.13
+ 2.9
+ -SNAPSHOT
+ 2.121.1
+ 8
+ 2.15
2.32
2.14
+ 2.28
+ true
@@ -89,18 +93,17 @@
org.jenkins-ci.plugins.workflow
workflow-api
- 2.16
-
-
- org.jenkins-ci.plugins
- scm-api
-
-
+ ${workflow-api-plugin.version}
org.jenkins-ci.plugins
structs
- 1.6
+ 1.14
+
+
+ org.jenkins-ci.plugins
+ apache-httpcomponents-client-4-api
+ 4.5.5-3.0
org.jenkins-ci.plugins.workflow
@@ -194,5 +197,12 @@
2.8
test
+
+ org.jenkins-ci.plugins.workflow
+ workflow-api
+ ${workflow-api-plugin.version}
+ tests
+ test
+
diff --git a/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStep.java b/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStep.java
index 4b10f04d..58bb3726 100644
--- a/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStep.java
+++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStep.java
@@ -4,6 +4,7 @@
import hudson.Extension;
import hudson.FilePath;
import hudson.model.Run;
+import hudson.model.TaskListener;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
@@ -45,7 +46,7 @@ public String getDisplayName() {
}
@Override public Set extends Class>> getRequiredContext() {
- return ImmutableSet.of(FilePath.class, Run.class);
+ return ImmutableSet.of(FilePath.class, Run.class, TaskListener.class);
}
}
diff --git a/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStepExecution.java b/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStepExecution.java
index bc93a0f9..a8122ce3 100644
--- a/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStepExecution.java
+++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/ArtifactUnarchiverStepExecution.java
@@ -4,19 +4,19 @@
import hudson.AbortException;
import hudson.FilePath;
import hudson.model.Run;
+import hudson.model.TaskListener;
+import io.jenkins.plugins.httpclient.RobustHTTPClient;
import jenkins.model.ArtifactManager;
import jenkins.util.VirtualFile;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-/**
- * @author Kohsuke Kawaguchi
- */
public class ArtifactUnarchiverStepExecution extends SynchronousNonBlockingStepExecution> {
@SuppressFBWarnings(value="SE_TRANSIENT_FIELD_NOT_RESTORED", justification="Only used when starting.")
@@ -34,6 +34,7 @@ public class ArtifactUnarchiverStepExecution extends SynchronousNonBlockingStepE
protected List run() throws Exception {
// where to copy artifacts from?
Run, ?> r = getContext().get(Run.class); // TODO consider an option to override this (but in what format?)
+ TaskListener listener = getContext().get(TaskListener.class);
ArtifactManager am = r.getArtifactManager();
@@ -50,11 +51,11 @@ protected List run() throws Exception {
if (dst.isDirectory())
dst = dst.child(getFileName(all[0]));
- files.add(copy(am.root().child(all[0]), dst));
+ files.add(copy(am.root().child(all[0]), dst, listener));
} else {
// copy into a directory
for (String path : all) {
- files.add(copy(am.root().child(path), dst.child(path)));
+ files.add(copy(am.root().child(path), dst.child(path), listener));
}
}
}
@@ -62,9 +63,14 @@ protected List run() throws Exception {
return files;
}
- private FilePath copy(VirtualFile src, FilePath dst) throws IOException, InterruptedException {
- try (InputStream in = src.open()) {
- dst.copyFrom(in);
+ private FilePath copy(VirtualFile src, FilePath dst, TaskListener listener) throws IOException, InterruptedException {
+ URL u = src.toExternalURL();
+ if (u != null) {
+ new RobustHTTPClient().copyFromRemotely(dst, u, listener);
+ } else {
+ try (InputStream in = src.open()) {
+ dst.copyFrom(in);
+ }
}
return dst;
}
diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java
index 7110f03c..02ac7c3c 100644
--- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java
+++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/StashStep.java
@@ -25,8 +25,10 @@
package org.jenkinsci.plugins.workflow.support.steps.stash;
import com.google.common.collect.ImmutableSet;
+import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
+import hudson.Launcher;
import hudson.Util;
import hudson.model.Run;
import hudson.model.TaskListener;
@@ -110,7 +112,7 @@ public static class Execution extends SynchronousNonBlockingStepExecution
}
@Override protected Void run() throws Exception {
- StashManager.stash(getContext().get(Run.class), step.name, getContext().get(FilePath.class), getContext().get(TaskListener.class), step.includes, step.excludes,
+ StashManager.stash(getContext().get(Run.class), step.name, getContext().get(FilePath.class), getContext().get(Launcher.class), getContext().get(EnvVars.class), getContext().get(TaskListener.class), step.includes, step.excludes,
step.useDefaultExcludes, step.allowEmpty);
return null;
}
@@ -128,7 +130,7 @@ public static class Execution extends SynchronousNonBlockingStepExecution
}
@Override public Set extends Class>> getRequiredContext() {
- return ImmutableSet.of(Run.class, FilePath.class, TaskListener.class);
+ return ImmutableSet.of(Run.class, FilePath.class, Launcher.class, EnvVars.class, TaskListener.class);
}
@Override public String argumentsToString(Map namedArgs) {
diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/UnstashStep.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/UnstashStep.java
index 4afb003b..85a46605 100644
--- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/UnstashStep.java
+++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/stash/UnstashStep.java
@@ -26,8 +26,10 @@
import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
+import hudson.Launcher;
import hudson.model.Run;
import hudson.model.TaskListener;
import java.util.Set;
@@ -71,7 +73,7 @@ public static class Execution extends SynchronousNonBlockingStepExecution
}
@Override protected Void run() throws Exception {
- StashManager.unstash(getContext().get(Run.class), name, getContext().get(FilePath.class), getContext().get(TaskListener.class));
+ StashManager.unstash(getContext().get(Run.class), name, getContext().get(FilePath.class), getContext().get(Launcher.class), getContext().get(EnvVars.class), getContext().get(TaskListener.class));
return null;
}
@@ -88,7 +90,7 @@ public static class Execution extends SynchronousNonBlockingStepExecution
}
@Override public Set extends Class>> getRequiredContext() {
- return ImmutableSet.of(Run.class, FilePath.class, TaskListener.class);
+ return ImmutableSet.of(Run.class, FilePath.class, Launcher.class, EnvVars.class, TaskListener.class);
}
}
diff --git a/src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java b/src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java
index d10373e7..3fb974fc 100644
--- a/src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java
+++ b/src/test/java/org/jenkinsci/plugins/workflow/steps/ArtifactArchiverStepTest.java
@@ -1,22 +1,26 @@
package org.jenkinsci.plugins.workflow.steps;
import java.util.Arrays;
+import jenkins.model.ArtifactManagerConfiguration;
import jenkins.util.VirtualFile;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
+import org.jenkinsci.plugins.workflow.DirectArtifactManagerFactory;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
-import org.junit.Assert;
+import static org.junit.Assert.*;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
-/**
- * @author Kohsuke Kawaguchi
- */
-public class ArtifactArchiverStepTest extends Assert {
+public class ArtifactArchiverStepTest {
+
+ @ClassRule public static BuildWatcher watcher = new BuildWatcher();
+
@Rule public JenkinsRule j = new JenkinsRule();
/**
@@ -74,5 +78,18 @@ public void archive() throws Exception {
j.assertLogContains("one/two", b);
}
-}
+ @Issue("JENKINS-49635")
+ @Test
+ public void directDownload() throws Exception {
+ ArtifactManagerConfiguration.get().getArtifactManagerFactories().add(new DirectArtifactManagerFactory());
+ j.createSlave("remote1", null, null);
+ j.createSlave("remote2", null, null);
+ WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
+ p.setDefinition(new CpsFlowDefinition("node('remote1') {writeFile file: 'x', text: 'contents'; archiveArtifacts 'x'}; node('remote2') {unarchive mapping: [x: 'x']; echo(/loaded ${readFile('x')}/)}", true));
+ DirectArtifactManagerFactory.whileBlockingOpen(() -> {
+ j.assertLogContains("loaded contents", j.buildAndAssertSuccess(p));
+ return null;
+ });
+ }
+}
diff --git a/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java b/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
index a1e3ba00..71ba75f7 100644
--- a/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
+++ b/src/test/java/org/jenkinsci/plugins/workflow/steps/CoreWrapperStepTest.java
@@ -40,7 +40,6 @@
import hudson.model.Run;
import hudson.model.Slave;
import hudson.model.TaskListener;
-import hudson.slaves.CommandLauncher;
import hudson.slaves.ComputerLauncher;
import hudson.slaves.NodeProperty;
import hudson.slaves.RetentionStrategy;