GitLab Artifact API, get last artifact by job name
Release notes
GitLab should support retrieving the artifacts from the last successful run of a job, by name, given a project. Regardless of pipeline success.
Problem to solve
There are two problems this will solve.
- User Bob creates a conditional job with
rules:changes
. The job may or may not run. Currently the API only allows you to find the artifacts for jobs in the last successful pipeline run. If you could retrieve the artifacts from the last successful run of a job, by name, given a project you could find conditional jobs that may not be on exist on the last successful pipeline run. - Currently you can not find artifacts of failed pipelines. This would accommodate failed pipelines by allowing you to find their jobs which successfully produced artifacts. It is unfortunate because a pipeline could fail for any number of reasons, but if you delegate a job to another team and they maintain that job they'll want the artifacts created when the code was committed to the repository regardless of other failures that they'll be unconcerned with. Why should a documentation job which represents the last doc-artifact not be produced if code is committed which fails a step in a subsequent stage.
Without a simple API call you have to iterate through all the jobs on a project until you find the one that satisfies this.
Proposal
Provide GET /projects/:id/jobs/:job_name/artifacts/*artifact_path?branch=tag
Intended users
Edited by Evan Carroll