slolife
slolife

Reputation: 19870

Referencing a file from another Hudson job

What I have is two jobs, A and B, and I'd like job B to use a file from A's last stable build.

Seems like the Hudson UI is able to display all of the information, so I am hoping that there is some way, in Job B, to access that information.

There is probably a solution to copy the file, post build, to a shared location and use it from there, but I don't want to have to worry about Job A starting to build and attempting to whack the file while Job B has it in use.

Ah, but I guess I really do need to copy Job A's file somewhere, and probably put it in a directory named with the build number. Okay, so the new question is how to I get Job A's last stable build # from Job B?

Notes:

Upvotes: 2

Views: 1060

Answers (2)

William Leara
William Leara

Reputation: 10687

I would like to mention the Parameterized Trigger Plugin:

http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Trigger+Plugin

Ideally, I believe the best solution would be to have this plugin trigger build B with the file from build A. However, as the current status says, "Future •Support file parameters (for passing files from build to build)"

Until that support is added, what I do is copy the artifact from job A to a share, then use the Parameterized Trigger Plugin to trigger job B and give it the name (a unique name so there are no conflicts) of the file on the share. I put the file name in a "properties file" (see plugin documentation) in order to trigger job B. Job B can then grab the file and run.

Upvotes: 1

Michael Donohue
Michael Donohue

Reputation: 11876

Use the 'archive the artifacts' feature to archive the file you want in job A. Then in job B, pull down the file via the permalink to the last successful build.

Something like:

http://localhost:8080/job/A/lastSuccessfulBuild/artifact/myartifact.txt

but replace 'A' with your job name, and 'myartifact.txt' with the path to your artifact

Upvotes: 1

Related Questions