Artifact download via API does not work for branches
Summary
As a follow up on #233795 (closed), I found that downloading an `artifacts.zip archive is not working if API is used with a tag, while branch names work as expected. This was tested with GitLab-EE 13.9.1 (Ultimate).
According to documentation, a ref_name
can be a branch name or a tag.
See https://docs.gitlab.com/ee/api/job_artifacts.html#download-the-artifacts-archive
This is a curl
command I'm using for testing:
# working
curl --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxx" --output "artifact.zip" "https://gitlab.plc2.de/api/v4/projects/Playground%2F0815%2FFPGA/jobs/artifacts/master/download?job=AllInOne"
# not working
curl --header "PRIVATE-TOKEN: xxxxxxxxxxxxxxxx" --output "artifact.zip" "https://gitlab.plc2.de/api/v4/projects/Playground%2F0815%2FFPGA/jobs/artifacts/v0.13.7/download?job=AllInOne"
In case of failure, the downloaded content is:
{"message":"404 Not found"}
Steps to reproduce
- Create a repository and a simple CI job that produces artifacts.
- Tag your latest
master
branch. - Download artifacts using the API endpoints with branch name and tag name.
Example Project
Currently no example project is provided, because the reproducer is so simple.
What is the current bug behavior?
A file not found error is created.
What is the expected correct behavior?
Artifacts should be downloadable from tag names too. Especially as it is already described in documentation.
Relevant logs and/or screenshots
JSON response:
{"message":"404 Not found"}
Output of checks
Results of GitLab environment info
This was
tested with GitLab-EE 13.9.1
(Ultimate).
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)