Skip to content

Attempts to "Download the artifacts archive" for a tag ref via the Jobs API is failing with a "404 Not found"

Overview

We're attempting to download the artifacts archive via the following URL:

GET /projects/:id/jobs/artifacts/:ref_name/download?job=name

We're seeing this fail with the following error:

{"message":"404 Not found"}

When attempting to use a tag as the ref_name.

Components

We're using the following:

  • The v4 Jobs API
  • The GitLab Shared Runner

Test Cases

A few notes for background:

  • Attempts to download artifacts on the master ref works correctly: GET /projects/:id/jobs/artifacts/master/download?job=name
  • Attempts to download the artifacts from the expected job ID also works correctly: GET projects/:id/jobs/:job_id/artifacts
  • 🚫 Attempts to download artifacts with the specific tag as a ref fail.

I can, however confirm that these artifacts are available for this ref by running the following command:

curl -H"PRIVATE-TOKEN: XXXXXXXX" https://gitlab.com/api/v4/projects/12345678/jobs/000111222

Which returns a response like the following:

{
  "id": 000111222,
  "status": "success",
  "stage": "build",
  "name": "build-zip",
  "ref": "0.3.0",
  "tag": true,
  "created_at": "2020-04-28T12:56:51.203Z",
  "artifacts_file": {
    "filename": "artifacts.zip",
    "size": 371601
  },
  "artifacts_expire_at": null
}

My expectation from the documentation is that the following command should work:

curl -H"PRIVATE-TOKEN: XXXXXXXX" https://gitlab.com/api/v4/projects/12345678/jobs/artifacts/0.3.0/download?job=build-zip

Since it is a valid tag ref with a valid artifacts file. Instead, it fails with the following:

{"message":"404 Not found"}

This was working for previous tags for us, so I'm not sure if it's due to a regression here?

Edited by Will Baumann