diff --git a/docs/userguide/credentials.rst b/docs/userguide/credentials.rst index a2589e71..43d45ba9 100644 --- a/docs/userguide/credentials.rst +++ b/docs/userguide/credentials.rst @@ -64,10 +64,6 @@ are set, kas automatically creates a login file for the container registry at ``~/.docker/config.json``. This file is compatible with docker, podman and even skopeo. -In other words, if ``CI_REGISTRY``, ``CI_REGISTRY_USER`` and ``CI_JOB_TOKEN`` are -set, kas creates the container registry login file. -If ``CI_JOB_TOKEN`` and ``CI_SERVER_HOST`` are set, kas creates the ``.netrc`` file. - .. note:: Make sure to assign the correct permissions to the ``CI_JOB_TOKEN``. For details, see `GitLab CI/CD job token `_. @@ -75,12 +71,13 @@ If ``CI_JOB_TOKEN`` and ``CI_SERVER_HOST`` are set, kas creates the ``.netrc`` f Container Registry Authentication File -------------------------------------- -A file named ``config.json`` is saved as ``.docker/config.json`` in the kas home directory. -It contains credentials for the container registry login. -The syntax is specified `containers-auth.json specification `_. +A file named ``config.json`` is saved as ``.docker/config.json`` in the kas +home directory. It contains credentials for the container registry login. +The syntax is described in the ``containers-auth.json specification`` +(https://github.com/containers/image/blob/main/docs/containers-auth.json.5.md). The authentication file is compatible with docker, podman and skopeo. -When running in the GitLab CI, the ``CI_JOB_TOKEN`` is appended to automatically grant access -according to the job permissions. +When running in the GitLab CI, the ``CI_JOB_TOKEN`` is appended to +automatically grant access according to the job permissions. Netrc File ---------- diff --git a/kas/libcmds.py b/kas/libcmds.py index e7072ec0..db394c37 100644 --- a/kas/libcmds.py +++ b/kas/libcmds.py @@ -240,7 +240,8 @@ def _setup_registry_auth(self): token = os.environ['CI_JOB_TOKEN'] base64_token = base64.b64encode(token.encode()).decode() auths = data.get('auths', {}) - auths.update({os.environ['CI_REGISTRY']: {"auth": base64_token}}) + auths.update( + {os.environ['CI_REGISTRY']: {"auth": base64_token}}) data['auths'] = auths fds.seek(0) fds.write(json.dumps(data, indent=4))