-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services/pkg: create containers for buildbot and buildbot-builder
- Loading branch information
1 parent
77d88d1
commit 244d19c
Showing
8 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: buildbot-builder Service Container | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- services/pkg/buildbot-builder/** | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- services/pkg/buildbot-builder/** | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
main: | ||
uses: ./.github/workflows/build-pkg.yml | ||
with: | ||
service_name: buildbot-builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: buildbot Service Container | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- services/pkg/buildbot/** | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- services/pkg/buildbot/** | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
main: | ||
uses: ./.github/workflows/build-pkg.yml | ||
with: | ||
service_name: buildbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ghcr.io/void-linux/void-glibc-full:20240526R1 AS build | ||
|
||
RUN xbps-install -Suy xbps && xbps-install -uy git go | ||
ARG GO_XBPS_SRC_VERSION=4c394976975f7e84062f56d437b41a0d48043792 | ||
RUN env GOBIN=/usr/local/bin GOMODCACHE=/tmp/go \ | ||
go install -v github.com/Duncaen/go-xbps-src/cmd/xbps-src-make@$GO_XBPS_SRC_VERSION | ||
|
||
FROM build AS buildbot-builder | ||
RUN xbps-install -Suy xbps && xbps-install -uy python3 tini git curl bash make rsync | ||
COPY --from=build /usr/local/bin/xbps-src-make /usr/local/bin/xbps-src-make | ||
RUN rm -rf /var/cache/xbps && \ | ||
groupadd --gid 418 void-builder && \ | ||
useradd --uid 418 --gid 418 -G xbuilder -M -d /buildbot void-builder && \ | ||
mkdir /venv /buildbot && \ | ||
chown void-builder:void-builder /venv /buildbot | ||
USER void-builder | ||
# version must be synced with ../buildbot | ||
RUN python3 -m venv /venv && \ | ||
/venv/bin/pip3 install wheel && \ | ||
/venv/bin/pip3 install 'buildbot-worker~=4.0.0' | ||
WORKDIR /buildbot | ||
RUN mkdir -p /buildbot && \ | ||
ln -sf /local/info /buildbot/info && \ | ||
ln -sf /local/xbps-src.conf /buildbot/.xbps-src.conf | ||
COPY buildbot.tac /buildbot/ | ||
ENTRYPOINT ["/usr/bin/tini", "--"] | ||
CMD ["/venv/bin/buildbot-worker", "start", "--nodaemon", "/buildbot"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# vim: set filetype=python: | ||
|
||
import os | ||
import configparser | ||
|
||
from buildbot_worker.bot import Worker | ||
|
||
from twisted.application import service | ||
from twisted.python.logfile import LogFile | ||
from twisted.python.log import ILogObserver, FileLogObserver | ||
|
||
basedir = '.' | ||
rotateLength = 10000000 | ||
maxRotatedFiles = 10 | ||
|
||
# if this is a relocatable tac file, get the directory containing the TAC | ||
if basedir == '.': | ||
import os.path | ||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
# note: this line is matched against to check that this is a worker | ||
# directory; do not edit it. | ||
application = service.Application('buildbot-worker') | ||
|
||
logfile = LogFile.fromFullPath( | ||
os.path.join(basedir, "twistd.log"), rotateLength=rotateLength, | ||
maxRotatedFiles=maxRotatedFiles) | ||
application.setComponent(ILogObserver, FileLogObserver(logfile).emit) | ||
|
||
ini = configparser.ConfigParser() | ||
ini.read_dict({'buildbot': {}, 'worker': {}}) | ||
ini.read('/local/config.ini') | ||
|
||
buildmaster_host = ini['buildbot'].get('host', 'localhost') | ||
port = ini['buildbot'].getint('worker-port', 9989) | ||
workername = ini['worker'].get('name', 'example-worker') | ||
with open("/secrets/buildbot/worker-password") as f: | ||
passwd = f.read() | ||
keepalive = ini['worker'].getint('keepalive', 600) | ||
umask = None | ||
maxdelay = ini['worker'].getint('maxdelay', 300) | ||
numcpus = None | ||
allow_shutdown = None | ||
maxretries = None | ||
use_tls = 0 | ||
delete_leftover_dirs = False | ||
proxy_connection_string = None | ||
protocol = 'pb' | ||
|
||
s = Worker(buildmaster_host, port, workername, passwd, basedir, | ||
keepalive, umask=umask, maxdelay=maxdelay, | ||
numcpus=numcpus, allow_shutdown=allow_shutdown, | ||
maxRetries=maxretries, protocol=protocol, useTls=use_tls, | ||
delete_leftover_dirs=delete_leftover_dirs, | ||
proxy_connection_string=proxy_connection_string) | ||
s.setServiceParent(application) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM ghcr.io/void-linux/void-glibc-full:20240526R1 | ||
|
||
RUN xbps-install -Suy xbps && xbps-install -uy python3 tini git curl | ||
ARG THEME_VERSION=v0.1.0 | ||
# version must be synced with ../buildbot-worker | ||
RUN python3 -m venv /venv && \ | ||
/venv/bin/pip3 install wheel && \ | ||
/venv/bin/pip3 install 'buildbot[tls,bundle]~=4.0.0' treq \ | ||
buildbot-prometheus buildbot-netauth \ | ||
git+https://github.com/void-linux/buildbot-theme.git@$THEME_VERSION | ||
WORKDIR /buildbot | ||
COPY buildbot.tac /buildbot/ | ||
COPY run.sh / | ||
# buildbot config should be in its basedir | ||
# buildbot upgrade-master hardcodes master.cfg | ||
RUN ln -sf /local/buildbot.cfg /buildbot/buildbot.cfg && \ | ||
ln -sf /buildbot/buildbot.cfg /buildbot/master.cfg | ||
ENTRYPOINT ["/usr/bin/tini", "--"] | ||
CMD ["/bin/sh", "/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# vim: set filetype=python: | ||
|
||
import os | ||
import sys | ||
|
||
from twisted.application import service | ||
from twisted.python.log import FileLogObserver | ||
from twisted.python.log import ILogObserver | ||
|
||
from buildbot.master import BuildMaster | ||
|
||
basedir = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
# note: this line is matched against to check that this is a buildmaster | ||
# directory; do not edit it. | ||
application = service.Application('buildmaster') | ||
application.setComponent(ILogObserver, FileLogObserver(sys.stdout).emit) | ||
|
||
m = BuildMaster(basedir, 'buildbot.cfg', umask=None) | ||
m.setServiceParent(application) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
: "${DB_UPGRADE:=$NOMAD_META_DB_UPGRADE}" | ||
|
||
if [ "$DB_UPGRADE" = "true" ]; then | ||
until /venv/bin/buildbot upgrade-master /buildbot; do | ||
echo "upgrading buildbot installation..." | ||
sleep 1 | ||
done | ||
fi | ||
|
||
exec /venv/bin/buildbot start --nodaemon /buildbot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters