@@ -123,48 +123,109 @@ We have the following two roles:
123
123
124
124
##### Integration with GitHub
125
125
126
- To integrate with GitHub using app authentication:
127
-
128
- 1 . ** GitHub App** :
129
- 1 . Create a new GitHub app by navigating to
130
- ` https://github.com/settings/apps/new ` for single-user installations or
131
- ` https://github.com/organizations/<org>/settings/apps/new ` for
132
- organisations where ` <org> ` is the name of your GitHub organizaction.
133
- 2 . GitHub App Name: "buildbox-nix <org >"
134
- 3 . Homepage URL: ` https://buildbot.<your-domain> `
135
- 4 . Callback URL: ` https://buildbot.<your-domain>/auth/login ` .
136
- 5 . Disable the Webhook
137
- 6 . Repository Permissions:
138
- - Contents: Read-only
139
- - Commit statuses: Read and write
140
- - Metadata: Read-only
141
- - Webhooks: Read and write
142
- 7 . Organisation Permissions (only if you create this app for an
143
- organisation):
144
- - Members: Read-only
145
- 2 . ** GitHub App private key** : Get the app private key and app ID from GitHub,
146
- configure using the buildbot-nix NixOS module.
147
- - Set
148
- ` services.buildbot-nix.master.github.authType.app.id = <your-github-id>; `
149
- - Set
150
- ` services.buildbot-nix.master.github.authType.app.secretKeyFile = "/path/to.pem"; `
151
- 3 . ** Install App** : Install the app for an organization or specific user.
152
- 4 . ** Refresh GitHub Projects** : Currently buildbot-nix doesn't respond to
153
- changes (new repositories or installations) automatically, it is therefore
154
- necessary to manually trigger a reload or wait for the next periodic reload.
155
-
156
- ##### Optional when using GitHub login
157
-
158
- 1 . ** GitHub App** : Set up a GitHub app for Buildbot to enable GitHub user
159
- authentication on the Buildbot dashboard. (can be the same as for GitHub App
160
- auth)
161
- 2 . ** OAuth Credentials** : After installing the app, generate OAuth credentials
162
- and configure them in the buildbot-nix NixOS module. Set the callback url to
163
- ` https://<your-domain>/auth/login ` .
164
-
165
- Afterwards add the configured github topic to every project that should build
166
- with buildbot-nix. Notice that the buildbot user needs to have admin access to
167
- this repository because it needs to install a webhook.
126
+ Buildbot-nix uses GitHub App authentication to integrate with GitHub
127
+ repositories. This enables automatic webhook setup, commit status updates, and
128
+ secure authentication.
129
+
130
+ ###### Step 1: Create a GitHub App
131
+
132
+ 1 . Navigate to:
133
+ - For personal accounts: ` https://github.com/settings/apps/new `
134
+ - For organizations:
135
+ ` https://github.com/organizations/<org>/settings/apps/new `
136
+
137
+ 2 . Configure the app with these settings:
138
+ - ** GitHub App Name** : ` buildbot-nix-<org> ` (or any unique name)
139
+ - ** Homepage URL** : ` https://buildbot.<your-domain> `
140
+ - ** Webhook** : Disable (buildbot-nix creates webhooks per repository)
141
+ - ** Callback URL** (optional, for OAuth):
142
+ ` https://buildbot.<your-domain>/auth/login `
143
+
144
+ 3 . Set the required permissions:
145
+ - ** Repository Permissions:**
146
+ - Contents: Read-only (to clone repositories)
147
+ - Commit statuses: Read and write (to report build status)
148
+ - Metadata: Read-only (basic repository info)
149
+ - Webhooks: Read and write (to automatically create webhooks)
150
+ - ** Organization Permissions** (if app is for an organization):
151
+ - Members: Read-only (to verify organization membership for access control)
152
+
153
+ 4 . After creating the app:
154
+ - Note the ** App ID**
155
+ - Generate and download a ** private key** (.pem file)
156
+
157
+ ###### Step 2: Configure buildbot-nix
158
+
159
+ Add the GitHub configuration to your NixOS module:
160
+
161
+ ``` nix
162
+ services.buildbot-nix.master = {
163
+ authBackend = "github";
164
+ github = {
165
+ authType.app = {
166
+ id = <your-app-id>; # The numeric App ID
167
+ secretKeyFile = "/path/to/private-key.pem"; # Path to the downloaded private key
168
+ };
169
+
170
+ # Optional: Enable OAuth for user login
171
+ oauth = {
172
+ id = "<oauth-client-id>";
173
+ secretFile = "/path/to/oauth-secret";
174
+ };
175
+
176
+ # Optional: Filter which repositories to build
177
+ topic = "buildbot-nix"; # Only build repos with this topic
178
+ };
179
+ };
180
+ ```
181
+
182
+ ###### Step 3: Install the GitHub App
183
+
184
+ 1 . Go to your app's settings page
185
+ 2 . Click "Install App" and choose which repositories to grant access
186
+ 3 . The app needs access to all repositories you want to build with buildbot-nix
187
+
188
+ ###### Step 4: Repository Configuration
189
+
190
+ For each repository you want to build:
191
+
192
+ 1 . ** Add the configured topic** (if using topic filtering):
193
+ - Go to repository settings
194
+ - Add the topic (e.g., ` buildbot-nix ` ) to enable builds
195
+
196
+ 2 . ** Automatic webhook creation** :
197
+ - Buildbot-nix automatically creates webhooks when:
198
+ - Projects are loaded on startup
199
+ - The project list is manually reloaded
200
+ - The webhook will be created at:
201
+ ` https://buildbot.<your-domain>/change_hook/github `
202
+
203
+ ###### How It Works
204
+
205
+ - ** Authentication** : Uses GitHub App JWT tokens for API access and installation
206
+ tokens for repository-specific operations
207
+ - ** Project Discovery** : Automatically discovers repositories the app has access
208
+ to, filtered by topic if configured
209
+ - ** Webhook Management** : Automatically creates and manages webhooks for push
210
+ and pull_request events
211
+ - ** Status Updates** : Reports build status back to GitHub commits and pull
212
+ requests
213
+ - ** Access Control** :
214
+ - Admins: Configured users can reload projects and manage builds
215
+ - Organization members: Can restart their own builds
216
+
217
+ ###### Troubleshooting
218
+
219
+ - ** Projects not appearing** : Check that:
220
+ - The GitHub App is installed for the repository
221
+ - The repository has the configured topic (if filtering by topic)
222
+ - Reload projects manually through the Buildbot UI
223
+
224
+ - ** Webhooks not created** : Verify the app has webhook write permission for the
225
+ repository
226
+
227
+ - ** Authentication issues** : Ensure the private key file is readable by the
228
+ buildbot service
168
229
169
230
##### Integration with Gitea
170
231
0 commit comments