From 99abb6c880cf119ec67cd6fcfc28fea3019392b2 Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Thu, 25 Nov 2021 13:59:04 +0530 Subject: [PATCH] Updated buildbot and travis in Dockerfile.bionic --- .../{Dockerfile.travis => Dockerfile.bionic} | 37 +++++++++++++++---- packages/docker/buildbot-entrypoint.sh | 9 +++++ run-tests-in-docker.sh | 5 ++- 3 files changed, 42 insertions(+), 9 deletions(-) rename packages/docker/{Dockerfile.travis => Dockerfile.bionic} (70%) create mode 100644 packages/docker/buildbot-entrypoint.sh diff --git a/packages/docker/Dockerfile.travis b/packages/docker/Dockerfile.bionic similarity index 70% rename from packages/docker/Dockerfile.travis rename to packages/docker/Dockerfile.bionic index a36e98b0..3a201435 100644 --- a/packages/docker/Dockerfile.travis +++ b/packages/docker/Dockerfile.bionic @@ -1,8 +1,12 @@ -FROM ubuntu:bionic AS pybm-travis-bionic +FROM ubuntu:bionic AS base ENV DEBIAN_FRONTEND noninteractive ENV TRAVIS_SKIP_APT_UPDATE 1 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + RUN apt-get update RUN apt-get install -yq --no-install-suggests --no-install-recommends \ @@ -38,27 +42,46 @@ RUN apt-get install -yq --no-install-suggests --no-install-recommends \ build-essential libcap-dev tor \ language-pack-en + # cleanup RUN rm -rf /var/lib/apt/lists/* -RUN useradd -m -U builder +##################################################################################################### -RUN echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +FROM base AS travis # travis2bash RUN wget -O /usr/local/bin/travis2bash.sh https://git.bitmessage.org/Bitmessage/buildbot-scripts/raw/branch/master/travis2bash.sh RUN chmod +x /usr/local/bin/travis2bash.sh +RUN useradd -m -U builder +RUN echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + # copy sources COPY . /home/builder/src RUN chown -R builder.builder /home/builder/src USER builder -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - WORKDIR /home/builder/src ENTRYPOINT /usr/local/bin/travis2bash.sh + +##################################################################################################### + +FROM base AS buildbot + +# travis2bash +RUN wget -O /usr/local/bin/travis2bash.sh https://git.bitmessage.org/Bitmessage/buildbot-scripts/raw/branch/master/travis2bash.sh +RUN chmod +x /usr/local/bin/travis2bash.sh + +# copy entrypoint +COPY packages/docker/buildbot-entrypoint.sh entrypoint.sh +RUN chmod +x entrypoint.sh + +RUN useradd -m -U buildbot +RUN echo 'buildbot ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +USER buildbot + +ENTRYPOINT /entrypoint.sh "$BUILDMASTER" "$WORKERNAME" "$WORKERPASS" diff --git a/packages/docker/buildbot-entrypoint.sh b/packages/docker/buildbot-entrypoint.sh new file mode 100644 index 00000000..0e6ee5c3 --- /dev/null +++ b/packages/docker/buildbot-entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/bash + + +buildbot-worker create-worker /var/lib/buildbot/workers/default "$1" "$2" "$3" + +unset BUILDMASTER BUILDMASTER_PORT WORKERNAME WORKERPASS + +cd /var/lib/buildbot/workers/default +/usr/bin/dumb-init buildbot-worker start --nodaemon diff --git a/run-tests-in-docker.sh b/run-tests-in-docker.sh index 8b606bc8..9fa9bfcc 100755 --- a/run-tests-in-docker.sh +++ b/run-tests-in-docker.sh @@ -1,4 +1,5 @@ #!/bin/bash -docker build -t pybm-travis-bionic -f packages/docker/Dockerfile.travis . -docker run pybm-travis-bionic +docker build --target travis -t pybm -f packages/docker/Dockerfile.bionic . +docker run pybm +