Find a way to download files quickly without cloning the repo in CI
We're using this pattern in some cases to run a script quickly in a CI job:
variables:
GIT_STRATEGY: none
script:
- wget $CI_PROJECT_URL/raw/$CI_COMMIT_SHA/scripts/example.sh
- sh example.sh
This is fast because it doesn't have to clone the repository. However, this doesn't work for a private project, namely https://gitlab.com/gitlab-org/security/gitlab
Unfortunately, CI_JOB_TOKEN
cannot be used to access the above raw
endpoint, nor can it be used as a personal access token to access the API, thus we reverted to be using shallow clone in !22303 (merged)
We can:
- Find a way to separate two cases, or:
- Find a way so that we can still download the files in a private repository.
- We can set up another access token for this, if really needed.
- We should also verify if we successfully downloaded the files.
Edited by Lin Jen-Shin