-
Sébastien Heurtematte authoredSébastien Heurtematte authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
gitlab-token-registration.adoc 1.94 KiB
Get runner token registration
Table of contents
1. Projects token registration
Via projects api:
curl --silent --header "Private-Token: ${GITLAB_API_TOKEN}" "https://$GITLAB_URL/api/v4/projects/${PROJECT_ID}"
ex :
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/projects/1649"
{
...
"runners_token": "YYYYYYYYYYYYYYYY",
...
}
or with jq
:
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/projects/864" |jq .runners_token
"YYYYYYYYYYYYYYYY"
2. Groups token registration
Via groups api:
curl --silent --header "Private-Token: ${GITLAB_API_TOKEN}" "https://$GITLAB_URL/api/v4/groups/${GROUP_ID}"
ex :
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/groups/864" |jq .runners_token
{
...
"runners_token": "YYYYYYYYYYYYYYYY",
...
}
or with jq
:
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/groups/864"
"YYYYYYYYYYYYYYYY"
4. Admin for shared runner token registration
Via UI: https://gitlab.eclipse.org/admin/runners
⇒ button register an instance runner
Via API:
see: https://gitlab.com/gitlab-org/gitlab/-/issues/16319 https://stackoverflow.com/questions/53966117/unable-to-get-gitlab-runners-registration-token-from-database/54136551#54136551
Best way, it to store it in secret management tool.