Skip to content

Commit

Permalink
Merge pull request #80 from jglick/workflow-copyFromDownstreamBuild-J…
Browse files Browse the repository at this point in the history
…ENKINS-33577

[JENKINS-33577] Demonstration test
  • Loading branch information
ikedam committed Apr 10, 2016
2 parents 1f34b25 + 4635191 commit c7f1b41
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -24,7 +24,7 @@
<properties>
<jenkins.version>1.580.1</jenkins.version>
<java.level>6</java.level>
<workflow.version>1.1</workflow.version>
<workflow.version>1.4.2</workflow.version>
</properties>

<dependencies>
Expand Down
Expand Up @@ -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>
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit c7f1b41

Please sign in to comment.