Skip to content

Commit

Permalink
document how to inject git credentials in common CI systems
Browse files Browse the repository at this point in the history
This patch documents how to easily inject git credentials
in the Github Actions CI, as well as in Gitlab CI.

Signed-off-by: Felix Moessbauer <[email protected]>
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
fmoessbauer authored and jan-kiszka committed May 7, 2024
1 parent 1d180cc commit d64dd9e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/userguide/credentials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,33 @@ Git Configuration
A ``.gitconfig`` file can be used to provide credentials as well as
url rewrites of git repositories (``insteadof``). To support the patching
of git repositories, kas injects a ``[user]`` section, possibly overwriting
an existing one. When running in the Github CI, the ``.gitconfig`` file is
automatically injected. In addition, credential helpers can be used by
an existing one. In addition, credential helpers can be used by
setting the corresponding environment variables. These are added to the
``.gitconfig`` file as well.

Github Actions
~~~~~~~~~~~~~~

When running in a Github Action, the ``.gitconfig`` file is automatically
injected. In combination with the
`webfactory/ssh-agent <https://github.com/webfactory/ssh-agent>`_ action,
this automatically makes the required credentials available to kas and
bitbake.

Gitlab CI
~~~~~~~~~

When running in the Gitlab CI, the ``CI_JOB_TOKEN`` can be used to access
git repositories via https. kas automatically adds this token to the
``.netrc`` file, where it is picked up by git. To be able to clone via ssh
locally, but via https in the CI, a rewrite rule needs to be added to the
``KAS_PREMIRRORS`` CI environment variable. Example:

.. code-block:: yaml
variables:
KAS_PREMIRRORS: "git@${CI_SERVER_HOST}: https://${CI_SERVER_HOST}/"
Netrc File
----------

Expand Down

0 comments on commit d64dd9e

Please sign in to comment.