Starting with version v0.1.5
, GARM saves github endpoints and github credentials in the database.
To create a new GitHub endpoint, you can use the following command:
garm-cli github endpoint create \
--name example \
--description "Just an example ghes endpoint" \
--base-url https://ghes.example.com \
--upload-url https://upload.ghes.example.com \
--api-base-url https://api.ghes.example.com \
--ca-cert-path $HOME/ca-cert.pem
To list the available GitHub endpoints, you can use the following command:
ubuntu@garm:~/garm$ garm-cli github endpoint list
+------------+--------------------------+-------------------------------+
| NAME | BASE URL | DESCRIPTION |
+------------+--------------------------+-------------------------------+
| github.com | https://github.com | The github.com endpoint |
+------------+--------------------------+-------------------------------+
| example | https://ghes.example.com | Just an example ghes endpoint |
+------------+--------------------------+-------------------------------+
GARM has the option to use both Personal Access Tokens (PAT) or a GitHub App.
If you'll use a PAT (classic), you'll have to grant access for the following scopes:
public_repo
- for access to a repositoryrepo
- for access to a private repositoryadmin:org
- if you plan on using this with an organization to which you have accessmanage_runners:enterprise
- if you plan to use garm at the enterprise leveladmin:repo_hook
- if you want to allow GARM to install webhooks on repositories (optional)admin:org_hook
- if you want to allow GARM to install webhooks on organizations (optional)
Fine grained PATs are also supported as long as you grant the required privileges:
- Repository permissions:
Administration: Read & write
- needed to generate JIT config/registration token, remove runners, etc.Metadata: Read-only
- automatically enabled by aboveWebhooks: Read & write
- needed to install webhooks on repositories
- Organization permissions:
Self-hosted runners: Read & write
- needed to manage runners in an organizationWebhooks: Read & write
- needed to install webhooks on organizations
If you plan to use github apps, you'll need to select the following permissions:
- Repository permissions:
Administration: Read & write
Metadata: Read-only
Webhooks: Read & write
- Organization permissions:
Self-hosted runners: Read & write
Webhooks: Read & write
Note
To add a new GitHub credential, you can use the following command:
garm-cli github credentials add \
--name gabriel \
--description "GitHub PAT for user gabriel" \
--auth-type pat \
--pat-oauth-token gh_theRestOfThePAT \
--endpoint github.com
To add a new GitHub App credential, you can use the following command:
garm-cli github credentials add \
--name gabriel_app \
--description "Github App with access to repos" \
--endpoint github.com \
--auth-type app \
--app-id 1 \
--app-installation-id 99 \
--private-key-path $HOME/yourAppName.2024-03-01.private-key.pem
All sensitive data is encrypted at rest. The API will not return any sensitive info.
To list the available GitHub credentials, you can use the following command:
garm-cli github credentials list
To delete a GitHub credential, you can use the following command:
garm-cli github credentials delete <CREDENTIAL_ID>