views:

403

answers:

2

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:

  • Windows environment
+1  A: 

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

Michael Donohue
Excellent. Now, do you have any suggests on how to pull the file over HTTP from the hudson batch commands or some other plugin?I gave it some more thought last night and think I might need to shell out to NAnt to get this done. But still, with NAnt, how to download a file?
slolife
Is there anyway to resolve http://localhost:8080/job/A/lastSuccessfulBuild/artifact/ to a file system folder?Is there an environment variable that contains this?E.g. resolves to C:/hudson/jobs/A/builds/2009-12-08_12-21-28/archive/
Simon Brangwin
These comments are really distinct questions. It would be better to open a new stackoverflow question for them.
Michael Donohue
+1  A: 

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.

William Leara