title: Jenkins - discard/keep artifacts of a parameterized build
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>Is there a way to tell Jenkins to keep the latest artifacts for each build with different parameters and discard all others?</p>