Reputation: 19563
I have a jenkins pipeline that is triggered by an upstream job. The upstream creates a file with a string in it. I want to be able to access that string from the pipeline. Is there a way to get the data about the upstream job required to read the file, from within the Groovy sandbox?
Upvotes: 1
Views: 993
Reputation: 4471
You need to use the "step" "copy artifacts from another project".
It will look like the following:
step([$class: 'CopyArtifact', filter: '**/myFile.txt',
fingerprintArtifacts: true, flatten: true, projectName: "myProject-job-name",
selector: [$class: 'StatusBuildSelector', stable: true]])
Upvotes: 1