Skip to content
Permalink
Browse files

[JENKINS-33577] Demonstrate that SpecificBuildSelector suffices to co…

…py artifacts from a build downstream of a Pipeline build.
  • Loading branch information
jglick committed Mar 16, 2016
1 parent f0f5cd7 commit 12e65070887b67eb5c65bd88c2cb84153fa4b78d
Showing with 13 additions and 1 deletion.
  1. +1 −1 pom.xml
  2. +12 −0 src/test/java/hudson/plugins/copyartifact/CopyArtifactWorkflowTest.java
@@ -22,7 +22,7 @@
</licenses>

<properties>
<workflow.version>1.1</workflow.version>
<workflow.version>1.4.2</workflow.version>
</properties>

<dependencies>
@@ -45,6 +45,7 @@

import java.io.IOException;
import java.util.List;
import org.jvnet.hudson.test.Issue;

/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
@@ -123,6 +124,17 @@ public void testFilterByParametersForWorkflow() throws Exception {
assertEquals("foo", build.getWorkspace().child("artifact.txt").readToString());
}

/**
* Demonstrate that we can run a downstream build and then copy artifacts from it.
*/
@Issue("JENKINS-33577")
@Test
public void copyFromDownstreamBuild() throws Exception {
WorkflowJob us = createWorkflow("us", "step([$class: 'CopyArtifact', projectName: 'ds', selector: [$class: 'SpecificBuildSelector', buildNumber: \"${build('ds').number}\"]]); echo readFile('art')");
WorkflowJob ds = createWorkflow("ds", "writeFile file: 'art', text: env.BUILD_TAG; archive includes: 'art'");
jenkinsRule.assertLogContains("jenkins-ds-1", jenkinsRule.assertBuildStatusSuccess(us.scheduleBuild2(0)));
}

private void assertArtifactInArchive(Run b) {
List<WorkflowRun.Artifact> artifacts = b.getArtifacts();
Assert.assertEquals(1, artifacts.size());

0 comments on commit 12e6507

Please sign in to comment.
You can’t perform that action at this time.