:sectnumlevels: 4
:toclevels: 5
:sectnums: 4
:toc: left
:icons: font
:toc-title: Table of contents

= Get runner token registration

== Projects token registration

Via UI: `https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/settings/ci_cd`

Via projects api: 
[source,bash]
----
curl --silent --header "Private-Token: ${GITLAB_API_TOKEN}" "https://$GITLAB_URL/api/v4/projects/${PROJECT_ID}"
----

ex : 

[source,bash]
----
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/projects/1649" 
----

[source,json]
----
{
    ...

    "runners_token": "YYYYYYYYYYYYYYYY",
    ...
}
----

or with `jq`:

[source,bash]
----
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/projects/864" |jq .runners_token
----

[source,bash]
----
"YYYYYYYYYYYYYYYY"
----


== Groups token registration

Via UI: `https://gitlab.eclipse.org/groups/eclipse/oniro-core/-/settings/ci_cd`

Via groups api: 

[source,bash]
----
curl --silent --header "Private-Token: ${GITLAB_API_TOKEN}" "https://$GITLAB_URL/api/v4/groups/${GROUP_ID}"
----

ex : 

[source,bash]
----
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/groups/864" |jq .runners_token
----

[source,json]
----
{
    ...

    "runners_token": "YYYYYYYYYYYYYYYY",
    ...
}
----

or with `jq`:

[source,bash]
----
curl --silent --header "Private-Token: XXXXXXXXXXXX" "https://gitlab.eclipse.org/api/v4/groups/864"
----

[source,bash]
----
"YYYYYYYYYYYYYYYY"
----

== Projects vs groups token registration

NOTE: groups and projects token are the same!


== 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.