Add redirect for downloading/browsing build artifacts by git ref rather than build ID
Description including problem, use cases, benefits, and/or goals
People need to be able to share links to artifacts based on a git ref (branch, tag, etc.), without knowing a specific build ID. Examples include sharing a link in the README to the latest generated PDF. Because there can be multiple artifacts generated by different jobs in a pipeline, require a specific job to be specified as well.
/user/repo/builds/artifacts/git-ref/*?job=name redirect to
build-idwould be the most recent successful build matching the
- Any URL parameters after
artifactswould be included in the redirect.
/user/repo/builds/artifacts/master/download?job=buildwould respond with a download of
/user/repo/builds/artifacts/9.0/browse?job=testwould show the artifact browser from the
teststage of the last pipeline run on
/user/repo/builds/artifacts/develop/file/paper.pdf?job=pdfwould respond with a download of
Result: #4255 (comment 15077057)
- This should likely be exposed in the API as well, so
GET /project/:id/builds/artifacts/master/download?job=buildwould work.
- This only supports downloading of files. If a generated file is static HTML, like a coverage report for example, people might want to show the file as a web page rather than a download. This would be overly complicated and out of scope of this proposal.
- So far, I haven't seen anyone explicitly ask to download artifacts for all jobs in a single URL.
- Is the URL pattern unique enough that it won't mismatch? e.g. can someone name a job with a slash so
job/namecould be confused with
git-ref/job-name? Or a
job-nameof all numbers might be confused with a
build-id? Do we need to use
/buildsso it's more unique?
Links / references
- Related requests: #4250 (closed), #4768 (closed), #13234 (closed), #14419 (closed), #18097 (closed)
- Zendesk: https://gitlab.zendesk.com/agent/tickets/16085