Passing the artifacts of the current pipeline into a downstream job

1,001 views
Skip to first unread message

Greg Smith

unread,
Aug 15, 2016, 12:11:00 PM8/15/16
to Jenkins Users

Hi,

I am trying to build a workflow where one a pipeline job passes its artifacts into another (old style) job in Jenkins that we already have defined.

The freestyle job takes 2 parameters:  The project name, and the build number.  It then copies the artifacts from "Project" / "Build Number" into its workspace, and does stuff with it.

In my pipeline job, I am first saving my artifacts, and then I am calling my downstream job like this:

build job: 'Publish MyJob', parameters: [string(name: 'PROJECT_NAME', value: "${env.JOB_NAME}"), string(name: 'PROJECT_BUILD_NUMBER', value: "${env.BUILD_NUMBER}")], wait: false

The problem is that it seems that the downstream, freestyle project can't access the artifacts of the currently, still running pipeline job.  In my freestyle job, I'm getting this output:

ERROR: Unable to find a build for artifact copy from: Organization/MyJob/master

What is the correct way for a pipeline job to start a downstream job with the artifacts it just built?

Thanks,
Greg

Greg Smith

unread,
Aug 15, 2016, 1:09:01 PM8/15/16
to Jenkins Users
Never mind -- I seem to have found the solution to this:

1)  Set the freestyle project to use instead select the artifacts of "The upstream job that triggered this job"
2)  Set the wait on the build value to false, so that the pipeline build does not wait on running the other freestyle build

These together seem to have fixed the problem (though I didn't try them individually, maybe I could have gotten away with one or the other...)

Greg
Reply all
Reply to author
Forward
0 new messages