1

I am using my organization's Gitlab instance and want to upload to the package registry of a personal project from my CI pipeline. I have been able to up-and download from shared projects' package registries using the format specified in the documentation :

-'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file path/to/file.txt "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt"'

However, when I apply the same format in the CI pipeline for my personal project, this fails with the message: "The page could not be found or you don't have permission to view it." This makes sense IMO, since my username is part of the project URL. So I have tried different combinations of the URL, e.g.:

 "${CI_API_V4_URL}/my-username/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt"' 

Error: "422: The change you requested was rejected"

"${CI_API_V4_URL}/my-username/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt"' 

Error: "The provided content-type '' is not supported"

I have tried to use personal tokens, ci job tokens, project tokens, and deploy tokens to authenticate, and nothing works but I don't believe it is an access issue since I can push to the container registry of the same repository without issues.

Is there any way of finding out the correct URL to the package registry of a personal project? I cannot set up a regular project under "projects/" as I lack permissions. Any help is appreciated.

mghin
  • 11
  • 3

1 Answers1

0

You should URL-encode the project's path following instructions here.

For example, given the username my-username and project name my-project, you would use my-username%2Fmy-project as the project ID.