Skip to content

Using "Keep latest artifacts for the last successful jobs" feature is incompatible with "Download a single artifact" API

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When an artifact has expired, you can no longer retrieve a sub artifact using the API.

Steps to reproduce

Using the following .gitlab-ci.yml :

pdf:
  script: xelatex mycv.tex
  artifacts:
    paths:
      - mycv.pdf
    expire_in: 1 week
  • Run the pipeline
  • Wait for 8 days
  • Try to download the file throught API : GET /projects/:id/jobs/artifacts/:ref_name/raw/mycv.pdf?job=pdf

Example Project

What is the current bug behavior?

The artifact is no longer available throught the API, after it has expired.

  • GET /projects/:id/jobs/artifacts/:ref_name/download?job=name WORKS
  • GET /projects/:id/jobs/:job_id/artifacts/*artifact_path FAILS
  • GET /projects/:id/jobs/artifacts/:ref_name/raw/*artifact_path?job=name FAILS

Note that if we browse the artefact using Gitlab Website, it works perfectly and we are able to download the file

What is the expected correct behavior?

We should be able to download the artifact thought the API.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

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`)


System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.6.6p146
Gem Version:    2.7.10
Bundler Version:1.17.3
Rake Version:   12.3.3
Redis Version:  5.0.9
Git Version:    2.28.0
Sidekiq Version:5.2.9
Go Version:     unknown

GitLab information
Version:        13.3.1-ee
Revision:       f0a10848821
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     11.7

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)

Possible fixes

Edited by 🤖 GitLab Bot 🤖