Resolve "Support fetching last successful from Artifacts Archive with API"
What does this MR do and why?
This change adds a new feature to GitLab's job artifacts API that allows users to search for build artifacts across multiple successful pipeline runs, rather than just the most recent one.
Previously, when requesting artifacts from a specific job, the system would only look in the latest successful pipeline. If that job didn't exist or didn't have artifacts in the latest run, users would get a "not found" error - even if the job with artifacts existed in an earlier successful pipeline.
The new feature introduces an optional parameter called search_recent_successful_pipelines that, when set to true, tells the system to search through up to the last 100 successful pipelines to find the requested job and its artifacts. This is particularly useful when pipeline configurations change over time and certain jobs don't run in every pipeline, or when dealing with dynamic pipelines where jobs may appear conditionally.
The feature is controlled by a feature flag and is disabled by default to maintain backward compatibility. When enabled, it helps users reliably access artifacts from jobs that may not appear in the most recent pipeline run, solving common issues where build artifacts become temporarily "lost" due to pipeline configuration changes.
The implementation includes comprehensive documentation updates and extensive test coverage to ensure the feature works correctly across various scenarios including edge cases with different pipeline statuses, branch names with special characters, and the 100-pipeline search limit.
References
Screenshots or screen recordings
| Before | After |
|---|---|
|
|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #515864

