I've seen this: `git clone project2` in gitlab-ci.yml? as well as a bunch of similar posts with similar answers implying that one should use Git submodules.
Without getting into arguments about whether submodules in Git work well, in my case, that just isn't an option at all (what other project to check out depends on the arguments passed to the trigger of the job, or, at least, it should).
Another requirement is that I need to be able to track the user who started the chain of triggers. I.e. hard-coding my personal token, or just any token will not do it: I need GitLab to use the permissions of the user who executed the job in order to clone other repositories.
Short of giving up GitLab and looking for a mature CI alternative, is there any way to get this done?
As New CI job permissions model states that there are 2 options: use gitlab-ci-token:${CI_JOB_TOKEN}
or write it to ~/.netrc
(doesn't work for me).
But we have multiple dependent repositories defined in package.json
so our solution is to overwrite git config
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@your-gitlab.com/".insteadOf "ssh://[email protected]/"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With