Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab
GitLab
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 37,022
    • Issues 37,022
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 1,407
    • Merge requests 1,407
  • Requirements
    • Requirements
    • List
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #323186

Closed
Open
Created Mar 02, 2021 by Patrick Lehmann@paebbels

Artifact download via API does not work for branches

Summary

As a follow up on #233795, 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

  1. Create a repository and a simple CI job that produces artifacts.
  2. Tag your latest master branch.
  3. 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)

Possible fixes

Edited Mar 02, 2021 by Patrick Lehmann
Assignee
Assign to
Backlog
Milestone
Backlog
Assign milestone
Time tracking