Configure CI_JOB_TOKEN in git credential helper
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
More and more developer tools work with multiple Git repositories. To let this work, the parent tool uses Git under the hood to fetch dependent repositories.
In my current case, the parent tool is Antora. Antora is a multi-repo documentation generator. Generating a site from multiple repositories is triggered from the parent repository and multiple site sources can be fetched from additional repositories:
https://docs.antora.org/antora/2.2/playbook/configure-content-sources/#remote-urls
For private content, you can specify the credentials in the URL or you can use the credential helper. I want to refrain from using credentials in the URL as it requires then different variable substition between local developer setup and CI. I specify the URLs as:
https://gitlab.com/<my_org>/<my_repo>.git
On my local developer workstation, I only have to provide the credentials once and they are stored in my macOS Keychain app, which is my default credential helper.
On Gitlab CI, there is the CI_JOB_TOKEN which can be used to pull dependent repositories. Unfortunately, I have to populate the git credential helper manually in my pipelines with this info:
- Username:
gitlab-ci-token - Password:
${CI_JOB_TOKEN}
Could this be done automatically by Gitlab at the start of a pipeline?