Download generic package from another project with CI_JOB_TOKEN
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
In the documentation it is mentioned how to download a generic package in the CI: https://docs.gitlab.com/ee/user/packages/generic_packages/?tab=CI_JOB_TOKEN#publish-a-generic-package-by-using-cicd
Today we tried it and found out that it is not possible to download a generic package from another project with the CI_JOB_TOKEN. The Token Access was set to Access unrestricted.
We have gitlab-ee 17.1
This is the command:
$ wget --header="JOB-TOKEN: ${CI_JOB_TOKEN}" https://<gitlab-server>/api/v4/projects/<project-id>/packages/generic/<package-name>/<package-version>/<file>
It works fine when the ci is running for the project where the package is generated.
Response in a pipeline from another project that tries to download the package:
Resolving <gitlab-server> (<gitlab-server>)... <server-ip>
Connecting to <gitlab-server> (<gitlab-server>)|<server-ip>|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-08-08 11:31:41 ERROR 404: Not Found.
The only workaround we found is to use PRIVATE-TOKEN instead of JOB-TOKEN in the header and use a token with read-api scope.