What I got so far is, it is possible to Authenticate with Personal Access Token and include external CI script but a cleaner approach would be
Unfortunately, CI_JOB_TOKEN is very limited in scope. As of today (GitLab 11.0), you can only do two things with it:
References:
So you cannot use CI_JOB_TOKEN to download a file from another repository, neither via the raw endpoint (/raw//) nor the API.
Unfortunately, deploy keys don't help either -- they are only for SSH.
The only workable solution I've come up with is to use a separate user:
Reporter role./profile/personal_access_tokens) for that user with api and read_repository rights.BUILD_USER_TOKEN.$BUILD_USER_TOKEN in your CI script to access the API or project files.This is a huge hack, and I really hope to see GitLab make CI_JOB_TOKEN a first-class, read-only (?) token with rights to specified resources.