2

Please excuse my non-fluent terminology..

There is a Jenkins server, master and a few slaves, there is a pipeline job.. let's call it playground

I run the job once, I want to save some data somewhere. Run the job again, I want to get the data from previous build.

  • Given that the Jenkins server is bounded to a VPN
  • Given that the Job may run on master or any of the slaves
  • Given that the Job deletes the workspace with every build

I couldn't find a way to save and load the data..

One plugin that actually do this is the git plugin, that saves the commit id and reads it in the next build for the changelog

I went through the git plugin code.. I am very confused and cannot figure out how or where it is done!

Can someone point me in the right direction.

2
  • the only way i've gotten this to work across builds is by having some shared persistent storage. Can your nodes (agents) mount something like NFS or EFS? Can you access some form of object storage? Commented Oct 21, 2020 at 22:12
  • Probably I can.. but I wonder how does the git plugin is doing it.. it might hold the answer
    – TacB0sS
    Commented Oct 22, 2020 at 4:38

1 Answer 1

3

There's a simple two step process...

In your originating job, tick step [ X ] Archive the artifacts and set the files to archive. archive artifact config

The files are copied to the master, stored in the jobs folder tree, under the builds directory for each build, along with the log. (Delete the build and it deletes the artifacts that came from it).

Install the Copy Artifact plugin. Configure the job accordingly. Copy-artifact config

Despite the plugin's screenshot example, this is actually a bad practice for artifacts like jars. Those should be properly managed using an artifact repository like Nexus or JFrog.

See my response regarding keeping the the Jenkins space under control, managing the build and artifact retention soundly.

1
  • I saw that plugin before, but I didn't realize I can copy artifacts locally to a folder and mess with them.. thank you!!
    – TacB0sS
    Commented Oct 22, 2020 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.