CI 'latest artifact' download links not working

I’m having trouble getting the ‘latest artifact’ download links working. I can browse my build artifacts at a URL that looks like this:


At the top of that page, I see the headline “Job #479 in pipeline #747 for 02f1d537 from feature/gitlab-ci-pipeline by Pat Conant 53 minutes ago”. I infer from the headline that the commit ref value is “feature/gitlab-ci-pipeline”. According to this page, I should be able to use the following URL to get the artifacts from this job:


But I get a 404 instead of the expected artifact. I’ve also tried with the ‘%2F’ unencoded (as ‘/’) too, with the same results. I’ve even tried the API URL documented here:

This also returns a 404. The URL https://SERVERNAME/api/v4/projects/NAMESPACE%2FPROJECT/jobs/ works just fine.

What am I doing wrong? Is there some feature or permission that must be enabled in order to get the latest artifact links to work?



  • GitLab 10.2.4 Community Editiion

It helps to read the documentation closely:

Note: The latest artifacts are considered as the artifacts created by jobs in the latest pipeline that succeeded for the specific ref. Artifacts for other pipelines can be accessed with direct access to them.

I was trying to access the artifacts from the latest successful job while the pipeline was still in progress. The ‘latest’ artifacts won’t be available until the pipeline is complete.

Well, on 10.4.4 I have the same issue although my pipeline is long finished… Did I miss something?
I’m using curl -L --header "PRIVATE-TOKEN:xxxxxx" URL.

Also, you mention an URL with a - path component between PROJECT and jobs (https://servername/NAMESPACE/PROJECT/-/jobs/artifacts/feature%2Fgitlab-ci-pipeline/download?job=maven-build), and another one from the documentation (https://servername/api/v4/projects/NAMESPACE%2FPROJECT/jobs/artifacts/feature%2Fgitlab-ci-pipeline/download?job=maven-build). Which one did you use eventually?

Because my pipeline wasn’t finished, I couldn’t use either of the URL formats shown above. I updated our script to use the GitLab API to get the pipeline details, extract the job-id from the pipeline details, and then construct a link to get the artifact using the job-id. That ended up looking something like this:

RESPONSE=$(curl --insecure --silent "https://SERVER/api/v4/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope=success&private_token=${GITLAB_API_KEY}")
BUILD_JOB_ID=$(echo "${RESPONSE}" | jq -r '.[] | select(.name == "maven-build") | .id')
if [[ -z "$BUILD_JOB_ID" ]] ; then
  echo "No successful 'maven-build' job found for pipeline id ${CI_PIPELINE_ID}"
  exit 7
echo "        Build Job ID: ${BUILD_JOB_ID}"