How to download artifacts via API?

Gitlab Version: 15.1.3
GitLab Shell Version: 14.7.4
Docker version 20.10.17

My .gitlab-ci.yml

stages:
    - test

artifact_download:
    stage: test
    tags:
        - gitlab
    script:
        - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "http://my_ip/api/v4/projects/3/jobs/42/artifacts"'

My error:

Preparing the "docker" executor 00:01
Using Docker executor with image ubuntu: 20.04 ...
Pulling docker image ubuntu: 20.04 ...
WARNING: Failed to pull image with policy "always": invalid reference format (manager.go:240:0s)
ERROR: Job failed: failed to pull image "ubuntu: 20.04" with specified policies [always]: invalid reference format (manager.go:240:0s)

Please tell me what am I doing wrong. I followed these instructions. Thanks

Hi @alissia

I think your problem isn’t with downloading the artifacts, it’s in pulling the docker image ubuntu:20.04.

I’m not sure exactly what to suggest, but you might want to start by checking our tags and runners.

The problem is around the image. Can you pull the ubuntu image on your laptop ? I think there is a space after : . Try without.

docker pull ubuntu:20.04 is Ok for me.

1 Like