Cannot get artifact from upstream project from downstream =>404 Project Not Found


I have an upstream private project where I have:

in .gitlab-ci.yml of the upstream project:

  stage: build
     - tar cvf artifact.tar public/*
      - artifact.tar

and in the downstream one:

   stage: deploy
      - curl --location --output artifacts.tar<my_upstream_project_id>/jobs/artifacts/master/download?job=my_upstream_job&job_token=$CI_JOB_TOKEN

If I look into artifacts.tar, I have:

 $ cat artifacts.tar
 {"message":"404 Project Not Found"}

Typing part of the url (up to the project id) into the browser where I am logged into Gitlab, return correct json information but using another browser not logged, I get the exact same message.

So I guess I am missing or using bad credential.

I have based my sought on this page:

If you have suggestion or better the solution ! This will save the remaining hair from my head :slight_smile:


I reply to myself.
Even if it is not really clear, it seems the CI_JOB_TOKEN is only activated for higher gitlab subscription. I am using standard access.

Another way to do it, would be to store the artifact into git pages of the upstream job and then pull it from the downstream job. This way no more credential to use.

Before Gitlab 13.7:
There should be issues to download upstreams jobs’ artifacts directly, the documents are not clear and not work.
Please check:
The submitter also gave a workround bash script in the description.
After Gitlab 13.7, follow the documents:
It should use below section in downstream pipeline:

  script: cat artifact.txt
    - pipeline: $PARENT_PIPELINE_ID
      job: create-artifact