Get 404 when trying to download 'latest artifact' with link

Im trying to download the latest artifact for a build, but dont seem to be able to create the correct url.

From the doc. the url should be like this:
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<job_name>
example from doc:

https://gitlab.com/gitlab-org/gitlab/-/jobs/artifacts/master/download?job=coverage

the only thing i can see differs is that i have project with a format that is:

foo/qaz/baz

When i copy the url from the GitLab portal that works, but its tied to the job-id, so when i switch out the id with branch name it stops working.

This is the url from the portal downloading artifact from a job with job-id:
https://gitlab.com/orgname/foo/qaz/baz/-/jobs/123456/artifacts/download
This works

So the url i thought ended up with that isnt working is:
https://gitlab.com/orgname/foo/qaz/baz/-/jobs/artifacts/test/download?job=build
This gives a 404 error

1 Like

It looks like I’m having the same issue with my project.

I just found this issue that sounds related url to download the artifact of the latest build does not download the latest one. (#20230) · Issues · GitLab.org / GitLab · GitLab

Update ! I found the solution to my problem.

I have a pipeline with manual action and the manual action wasn’t done. It need to manual action to be done. It means the full full pipeline need to be successful.

Hopefully this comment will help.

3 Likes

This is insane, I spent like 12 hours figuring what’s wrong

Now, I have two very similar projects where some LaTeX files are compiled.
Both projects are public.
In both, there is a .gitlab_ci.yml file specifying the builds.
In both, there are recent successful builds (it nicely builds after each commit).
In project Mikel Forcada / propagation · GitLab the URL
https://gitlab.com/mlforcada/propagation/-/jobs/artifacts/master/raw/propagacion.pdf?job=compile_pdf
downloads the file propagacion.pdf from the artifacts produced by job compile_pdf
In project Mikel Forcada / chatgpt-lletres · GitLab a similarly constructed URL
https://gitlab.com/mlforcada/chatgpt-lletres/-/jobs/artifacts/master/raw/lnplm.pdf?job=compile_lnplm_pdf
does not work.
I have checked the settings of both projects and I cannot see any difference.

Note that in the second project, URLs downloading artifacts from a specific build job, using the job ID, work:
https://gitlab.com/mlforcada/chatgpt-lletres/-/jobs/6289014868/artifacts/download
That is, I can download jobs as zip files using the job run ID, but not the latest job by job name, and specific files too:
https://gitlab.com/mlforcada/chatgpt-lletres/-/jobs/6289014868/artifacts/raw/lnplm.pdf.

It must be something simple, but I wonder what it is.
Thanks-

Never mind. The problem was that the principal branch in the second project (newer) was not called master but rather main. That’s all! Leaving it here just it case it happens to someone else!