docs: crnm: document token usage

Judging by comments in the chat, it seems the usage of the tokens in crnm is
only natural when you've been using it for a while. New users would appreciate
reading it in the documentation, beyond the help in the tool.

Also, mentioning how to create a token and what's the minimal scope of the
token to be used with the tool can help new users.

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34860>
This commit is contained in:
Sergi Blanch Torne 2025-05-07 14:55:44 +02:00 committed by Marge Bot
parent acebfc7a38
commit e19e8012e4
2 changed files with 21 additions and 1 deletions

View file

@ -16,7 +16,9 @@ from functools import cache
from pathlib import Path from pathlib import Path
GITLAB_URL = "https://gitlab.freedesktop.org" GITLAB_URL = "https://gitlab.freedesktop.org"
TOKEN_DIR = Path(os.getenv("XDG_CONFIG_HOME") or Path.home() / ".config") TOKEN_DIR = Path(os.environ.get("XDG_CONFIG_HOME", "")
if os.environ.get("XDG_CONFIG_HOME", None)
else Path.home() / ".config")
# Known GitLab token prefixes: https://docs.gitlab.com/security/tokens/#token-prefixes # Known GitLab token prefixes: https://docs.gitlab.com/security/tokens/#token-prefixes
TOKEN_PREFIXES: dict[str, str] = { TOKEN_PREFIXES: dict[str, str] = {

View file

@ -301,6 +301,8 @@ and cancel the rest to avoid wasting resources.
See ``bin/ci/ci_run_n_monitor.py --help`` for all the options. See ``bin/ci/ci_run_n_monitor.py --help`` for all the options.
**Target jobs**
The ``--target`` argument takes a regex that you can use to select the The ``--target`` argument takes a regex that you can use to select the
jobs names you want to run, e.g. ``--target 'zink.*'`` will run all the jobs names you want to run, e.g. ``--target 'zink.*'`` will run all the
Zink jobs, leaving the other drivers' jobs free for others to use. Zink jobs, leaving the other drivers' jobs free for others to use.
@ -311,6 +313,22 @@ You can work around that by adding a dummy change in a file core to what you're
working on and then making a new push with that change, and removing that change working on and then making a new push with that change, and removing that change
before you create the MR. before you create the MR.
**GitLab token**
The ``--token`` argument is used to provide a GitLab token with rights to
interact with the pipeline. Using the argument, one can provide the value or
the name of the file having the value. If the argument is not provided, then
it checks if the value of ``$XDG_CONFIG_HOME`` has a valid directory (if not,
then uses ``$HOME/.config``), and there is a file called ``gitlab-token`` that
contains a token. The token required to work with this tool needs ``api``
scope permissions.
.. note::
To create that token, refer to
`create-a-personal-access-token <https://docs.gitlab.com/user/profile/personal_access_tokens/#create-a-personal-access-token>`_
and select the ``api`` scope. The token will only be shown once after creation,
so make sure you store it securely.
Conformance Tests Conformance Tests
----------------- -----------------