@@ -185,6 +185,87 @@ Here are the steps you can follow to do so:
185
185
buildbot.tac file to change the port number from 9994 to 9990 and start it
186
186
again.
187
187
188
+ Testing a Builder Config Locally
189
+ ================================
190
+
191
+ It is possible to test a builder running against a local version of LLVM's
192
+ buildmaster setup. This allows you to test changes to builder, worker, and
193
+ buildmaster configuration. A buildmaster launched in this "local testing" mode
194
+ will:
195
+ * Bind only to local interfaces.
196
+ * Use SQLite as the database.
197
+ * Use a single fixed password for workers.
198
+ * Disable extras like GitHub authentication.
199
+
200
+ In order to use this "local testing" mode:
201
+
202
+ * Within a checkout of `llvm-zorg <https://github.com/llvm/llvm-zorg >`_,
203
+ create and activate a Python `venv
204
+ <https://docs.python.org/3/library/venv.html> `_ and install the necessary
205
+ dependencies.
206
+
207
+ .. code-block :: bash
208
+
209
+ python -m venv bbenv
210
+ source bbenv/bin/activate
211
+ pip install buildbot{,-console-view,-grid-view,-waterfall-view,-worker,-www}==3.11.7 urllib3
212
+
213
+ * Initialise the necessary buildmaster files, link to the configuration in
214
+ ``llvm-zorg `` and ask ``buildbot `` to check the configuration. This step can
215
+ be run from any directory.
216
+
217
+ .. code-block :: bash
218
+
219
+ buildbot create-master llvm-testbbmaster
220
+ cd llvm-testbbmaster
221
+ ln -s /path/to/checkout/of/llvm-zorg/buildbot/osuosl/master/master.cfg .
222
+ ln -s /path/to/checkout/of/llvm-zorg/buildbot/osuosl/master/config/ .
223
+ ln -s /path/to/checkout/of/llvm-zorg/zorg/ .
224
+ BUILDBOT_TEST=1 buildbot checkconfig
225
+
226
+ * Start the buildmaster.
227
+
228
+ .. code-block :: bash
229
+
230
+ BUILDBOT_TEST=1 buildbot start --nodaemon .
231
+
232
+ * After waiting a few seconds for startup to complete, you should be able to
233
+ open the web UI at ``http://localhost:8011 ``. If there are any errors or
234
+ this isn't working, check ``twistd.log `` (within the current directory) for
235
+ more information.
236
+
237
+ * You can now create and start a buildbot worker. Ensure you pick the correct
238
+ name for the worker associated with the build configuration you want to test
239
+ in ``buildbot/osuosl/master/config/builders.py ``.
240
+
241
+ .. code-block :: bash
242
+
243
+ buildbot-worker create-worker < buildbot-worker-root-directory> \
244
+ localhost:9990 \
245
+ < buildbot-worker-name> \
246
+ test
247
+ buildbot-worker start --nodaemon < buildbot-worker-root-directory>
248
+
249
+ * Either wait until the poller sets off a build, or alternatively force a
250
+ build to start in the web UI.
251
+
252
+ * Review the progress and results of the build in the web UI.
253
+
254
+ This local testing configuration defaults to binding only to the loopback
255
+ interface for security reasons.
256
+
257
+ If you want to run the test worker on a different machine, or to run the
258
+ buildmaster on a remote server, ssh port forwarding can be used to make
259
+ connection possible. For instance, if running the buildmaster on a remote
260
+ server the following command will suffice to make the web UI accessible via
261
+ ``http://localhost:8011 `` and make it possible for a local worker to connect
262
+ to the remote buildmaster by connecting to ``localhost:9900 ``:
263
+
264
+ .. code-block :: bash
265
+
266
+ ssh -N -L 8011:localhost:8011 -L 9990:localhost:9990 username@buildmaster_server_address
267
+
268
+
188
269
Best Practices for Configuring a Fast Builder
189
270
=============================================
190
271
0 commit comments