Error 404 when trying to download an artifact within an other pipeline

Hi everyone

I have a job which downloads artifacts from another repository. We migrated our repos to a new self-managed gitlab, and since it doesn’t work anymore.

Here is the .gitlab-ci.yml I used for testing:

dl_artifact:
  image: curlimages/curl
  script:
    - curl -L -v --fail-with-body --show-error
      --header "$JOB_TOKEN_HEADER"
      "${CI_API_V4_URL}/projects/${TARGET_REPO}/jobs/artifacts/master/download?job=my_job"
  variables:
    TARGET_REPO: 123
    JOB_TOKEN_HEADER: "JOB-TOKEN: $CI_JOB_TOKEN"

Here is the output that curl gives me:

curl: (22) The requested URL returned error: 404
{"message":"404 Project Not Found"}
  • Both repositories have internal access, and I’m a maintainer on both of them.
  • We moved from a self-hosted Community Edition v17.9.2 to a self-hosted Enterprise Edition v18.2.1-ee.
  • I’ve added my repo to the Job token permissions of the repo I’m downloading the artifacts from.
  • I’ve tested with an access token inside and outside the pipeline and it works fine, so I guess it’s a job token permission issue, but I really can’t see where’s the problem.