Skip to content

Commit

Permalink
buildworker,buildmaster: Use venv for Pip
Browse files Browse the repository at this point in the history
Debian 12 complains if using Pip without a virtualenv since it could
break the system.

Signed-off-by: Paul Spooren <[email protected]>
  • Loading branch information
aparcar committed Sep 26, 2024
1 parent c0a50aa commit 7c603f4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
8 changes: 6 additions & 2 deletions docker/buildmaster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ RUN \
locales \
pv \
pwgen \
python3-venv \
python3-pip \
signify-openbsd \
wget && \
apt-get clean && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install -U pip
RUN \
pip3 install \
Expand All @@ -63,15 +66,16 @@ RUN \
"buildbot-worker==$BUILDBOT_VERSION" \
pyOpenSSL \
service_identity

RUN \
sed -i \
's/Welcome to buildbot/Welcome to OpenWrt buildbot/' \
/usr/local/lib/python*/dist-packages/buildbot_www/static/scripts.js
/opt/venv/lib/python*/site-packages/buildbot_www/static/scripts.js

RUN \
sed -i \
"s;\"col-sm-12\"><ul><li ng-repeat;\"col-sm-12\"><ul><li>OpenWrt version: <a href=\"https://git.openwrt.org/$OPENWRT_VERSION\">$OPENWRT_VERSION</a></li><li ng-repeat;" \
/usr/local/lib/python*/dist-packages/buildbot_www/static/scripts.js
/opt/venv/lib/python*/site-packages/buildbot_www/static/scripts.js

ENV LANG=en_US.utf8

Expand Down
6 changes: 3 additions & 3 deletions docker/buildmaster/files/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

case "${1:-start}" in
reconfig)
exec /usr/local/bin/buildbot reconfig /master
exec /opt/venv/bin/buildbot reconfig /master
;;
start)
case "${BUILDMASTER_PHASE:-1}" in
Expand All @@ -15,12 +15,12 @@ case "${1:-start}" in
;;
esac

/usr/local/bin/buildbot create-master --config=/phase${BUILDMASTER_PHASE:-1}/master.cfg /master
/opt/venv/bin/buildbot create-master --config=/phase${BUILDMASTER_PHASE:-1}/master.cfg /master

unset BUILDMASTER_PHASE

rm -f /master/twistd.pid
exec /usr/local/bin/buildbot start --nodaemon /master
exec /opt/venv/bin/buildbot start --nodaemon /master
;;
/*)
exec "$@"
Expand Down
3 changes: 3 additions & 0 deletions docker/buildworker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RUN \
pwgen \
python \
python3 \
python3-venv \
python3-pip \
qemu-utils \
rsync \
Expand All @@ -43,6 +44,8 @@ RUN \
apt-get clean && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install -U pip
RUN pip3 install \
"buildbot-worker==$BUILDBOT_VERSION" \
Expand Down
4 changes: 2 additions & 2 deletions docker/buildworker/files/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm -f /builder/buildbot.tac

use_tls=""
[ "$BUILDWORKER_TLS" = 1 ] && use_tls="--use-tls"
/usr/local/bin/buildbot-worker create-worker --force --umask="0o22" $use_tls /builder \
/opt/venv/bin/buildbot-worker create-worker --force --umask="0o22" $use_tls /builder \
"$BUILDWORKER_MASTER" "$BUILDWORKER_NAME" "$BUILDWORKER_PASSWORD"

if [ "$BUILDWORKER_TLS" = 1 ]; then
Expand All @@ -30,4 +30,4 @@ echo "$BUILDWORKER_DESCRIPTION" > /builder/info/host
unset BUILDWORKER_ADMIN BUILDWORKER_DESCRIPTION BUILDWORKER_MASTER BUILDWORKER_NAME BUILDWORKER_PASSWORD

rm -f /builder/twistd.pid
exec /usr/local/bin/buildbot-worker start --nodaemon /builder
exec /opt/venv/bin/buildbot-worker start --nodaemon /builder

0 comments on commit 7c603f4

Please sign in to comment.