buildworker,buildmaster: Use venv for Pip
authorPaul Spooren <mail@aparcar.org>
Thu, 26 Sep 2024 09:21:00 +0000 (11:21 +0200)
committerPetr Štetiar <ynezz@true.cz>
Thu, 26 Sep 2024 11:19:16 +0000 (11:19 +0000)
Debian 12 complains if using Pip without a virtualenv since it could
break the system.

Signed-off-by: Paul Spooren <mail@aparcar.org>
docker/buildmaster/Dockerfile
docker/buildmaster/files/start.sh
docker/buildworker/Dockerfile
docker/buildworker/files/start.sh

index d8f7f79dccefee1363610ea3e9f599eecb836c42..ccaf4a96baf3a9e4d94b7f7d392580b06e689cbd 100644 (file)
@@ -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 \
@@ -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
 
index 1058e51ca42d9fc8350c02a4bf19e9ada9c70daa..5fb06261c731e503fa06de6f7eb68a490f51a570 100644 (file)
@@ -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
@@ -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 "$@"
index e8d077b7f5753fd40533a5577d001fa206718a95..e6d75949016c3a9ff21e4e7706112dc147e96356 100644 (file)
@@ -31,6 +31,7 @@ RUN \
                pwgen \
                python \
                python3 \
+               python3-venv \
                python3-pip \
                qemu-utils \
                rsync \
@@ -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" \
index 81e267186825cfeae6fc7f7b422cb2755d16dd82..ef419d2d865e76448ba08efb700bf246dd1e09d5 100644 (file)
@@ -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
@@ -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