0

I'd like to store a JSON file as the output of one job, and read that JSON in and parse it for use in a pipeline in a different job. I'm having trouble getting the JSON from the first job into my workspace so I can read it.

This mentions reading in a JSON, but not how to get it into the workspace = Pass Jenkins Pipeline parameters from a Jenkins job?

I see some suggestions that involve adding build steps (URL SCM plugin), but adding build steps doesn't seem available in my pipeline job

1 Answer 1

1

You should have a look at archiveArtifacts and copyArtifacts. You would archive the JSON file in one job and then copy it from in the other.

Edit:

In a pipeline you would do something like:

copyArtifacts(projectName: 'sourceproject') 

or

copyArtifacts(projectName: 'downstream', selector: lastSuccessful()) 

You can look it up here: https://wiki.jenkins.io/display/JENKINS/Copy+Artifact+Plugin

Sign up to request clarification or add additional context in comments.

1 Comment

so the archiving artifacts portion works fine. I did check out copyArtifacts, but it's a build step that takes in from other jobs and puts it into the current job. The issue is that in a pipeline job I do not have the ability to add a build step from the GUI. Maybe I just need to understand how to do that via code in the jenkinsFile, and I'm trying to find how to do that using copyArtifacts but am struggling.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.