Reputation: 781
In Jenkins (or Hudson), I set up a pipeline of parameterized jobs, say A -> B, that copy artifacts from each other using the Copy Artifact Plugin. All jobs use the same parameter, e.g. the target platform. Each job is set to discard old builds and artifacts to limit disk usage, keeping only the latest stable build artifacts. I use parameterized builds to avoid having to maintain many jobs that only differ in the parameter setting.
This setup only works if all builds run after each other in a pipeline with the same parameter settings, and hence the latest build artifacts match the platform parameter setting of a dependent job. Now if someone first builds job A for platform x, and then for platform y, then builds B for platform x, the artifacts from A for platform x are already discarded and hence B cannot copy these.
Is there a way to tell Jenkins to keep the latest artifacts for each build with different parameters and discard all others?
Upvotes: 2
Views: 1776
Reputation: 16605
Manual solution: copy the artifacts from A into a directory that is keyed by the parameters. Job A will clean out the directory before the build - and thus make sure that stale artifacts do not pass to job B. Job B will clean out the directory after it runs in any case.
Upvotes: 0