You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ```github``` config section holds credentials and API endpoint information for accessing the GitHub APIs. Credentials are tied to the instance of GitHub you're using. Whether you're using [github.com](https://github.com) or your own deployment of GitHub Enterprise server, this section is how ```garm``` knows where it should create the runners.
3
+
Starting with version `v0.1.5`, GARM saves github endpoints and github credentials in the database.
4
4
5
-
Tying the API endpoint info to the credentials allows us to use the same ```garm``` installation with both [github.com](https://github.com) and private deployments. All you have to do is to add the needed endpoint info (see bellow).
5
+
Credentials are tied to a github endpoint. The GitHub endpoint can be either [github.com](https://github.com) or a [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@latest/admin/overview/about-github-enterprise-server).
6
+
7
+
By default, GARM will create a default [github.com](https://github.com) endpoint that cannot be removed or updated. If you want to use your own GHES endpoint, you will need to add a new endpoint
8
+
9
+
## Creating a new GitHub endpoint
10
+
11
+
To create a new GitHub endpoint, you can use the following command:
12
+
13
+
```bash
14
+
garm-cli github endpoint create \
15
+
--name example \
16
+
--description "Just an example ghes endpoint" \
17
+
--base-url https://ghes.example.com \
18
+
--upload-url https://upload.ghes.example.com \
19
+
--api-base-url https://api.ghes.example.com \
20
+
--ca-cert-path $HOME/ca-cert.pem
21
+
```
22
+
23
+
## Listing GitHub endpoints
24
+
25
+
To list the available GitHub endpoints, you can use the following command:
GARM has the option to use both [Personal Access Tokens (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) or a [GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app).
8
41
@@ -28,55 +61,28 @@ If you plan to use github apps, you'll need to select the following permissions:
28
61
29
62
**Note**:warning:: Github Apps are not available at the enterprise level.
30
63
31
-
The resulting credentials (app or PAT) must be configured in the ```[[github]]``` section of the config. Sample as follows:
32
-
33
-
```toml
34
-
# This is a list of credentials that you can define as part of the repository
35
-
# or organization definitions. They are not saved inside the database, as there
36
-
# is no Vault integration (yet). This will change in the future.
37
-
# Credentials defined here can be listed using the API. Obviously, only the name
38
-
# and descriptions are returned.
39
-
[[github]]
40
-
name = "gabriel"
41
-
description = "github token or user gabriel"
42
-
# This is the type of authentication to use. It can be "pat" or "app"
43
-
auth_type = "pat"
44
-
[github.pat]
45
-
# This is a personal token with access to the repositories and organizations
46
-
# you plan on adding to garm. The "workflow" option needs to be selected in order
47
-
# to work with repositories, and the admin:org needs to be set if you plan on
48
-
# adding an organization.
49
-
oauth2_token = "super secret token"
50
-
[github.app]
51
-
# This is the app_id of the GitHub App that you want to use to authenticate
52
-
# with the GitHub API.
53
-
# This needs to be changed
54
-
app_id = 1
55
-
# This is the private key path of the GitHub App that you want to use to authenticate
# This is the installation_id of the GitHub App that you want to use to authenticate
60
-
# with the GitHub API.
61
-
# This needs to be changed
62
-
installation_id = 99
63
-
# base_url (optional) is the URL at which your GitHub Enterprise Server can be accessed.
64
-
# If these credentials are for github.com, leave this setting blank
65
-
base_url = "https://ghe.example.com"
66
-
# api_base_url (optional) is the base URL where the GitHub Enterprise Server API can be accessed.
67
-
# Leave this blank if these credentials are for github.com.
68
-
api_base_url = "https://ghe.example.com"
69
-
# upload_base_url (optional) is the base URL where the GitHub Enterprise Server upload API can be accessed.
70
-
# Leave this blank if these credentials are for github.com, or if you don't have a separate URL
71
-
# for the upload API.
72
-
upload_base_url = "https://api.ghe.example.com"
73
-
# ca_cert_bundle (optional) is the CA certificate bundle in PEM format that will be used by the github
74
-
# client to talk to the API. This bundle will also be sent to all runners as bootstrap params.
75
-
# Use this option if you're using a self signed certificate.
76
-
# Leave this blank if you're using github.com or if your certificate is signed by a valid CA.
77
-
ca_cert_bundle = "/etc/garm/ghe.crt"
64
+
To add a new GitHub credential, you can use the following command:
65
+
66
+
```bash
67
+
garm-cli github credentials add \
68
+
--name gabriel \
69
+
--description "GitHub PAT for user gabriel" \
70
+
--auth-type pat \
71
+
--pat-oauth-token gh_theRestOfThePAT \
72
+
--endpoint github.com
78
73
```
79
74
80
-
The double parenthesis means that this is an array. You can specify the ```[[github]]``` section multiple times, with different tokens from different users, or with different access levels. You will then be able to list the available credentials using the API, and reference these credentials when adding repositories or organizations.
75
+
To add a new GitHub App credential, you can use the following command:
0 commit comments