yocto-autobuilder2/docker/Dockerfile
Mathieu Dubois-Briand f12b6454a1 docker: Allow to use any worker for builders of previous releases
As today we only provide dummy workers, allow to use these for any
builder, or some jobs would never be run.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-07-07 22:22:41 +01:00

4.8 KiB

FROM ubuntu:24.04

ARG AUTOBUILDER2_BRANCH=master

USER root

Install needed packages

ENV DEBIAN_FRONTEND=noninteractive RUN apt update &&
apt full-upgrade -y &&
apt -y install
bind9-host
build-essential
chrpath
cpio
debianutils
diffstat
file
gawk
gcc
git
iproute2
iputils-ping
libacl1
libcairo2
liblz4-tool
locales
npm
python3
python3-git
python3-jinja2
python3-pexpect
python3-pip
python3-subunit
socat
texinfo
unzip
virtualenv
wget
xz-utils
zstd

RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8

RUN npm install -g yarn

RUN pip3 install --break-system-packages
buildbot==4.2.1
buildbot-www==4.2.1
buildbot-waterfall-view==4.2.1
buildbot-console-view==4.2.1
buildbot-grid-view==4.2.1
buildbot-worker==4.2.1
buildbot_pkg==4.2.1
websockets

Uncomment and update following code to use a custom buildbot branch

RUN pip3 install --break-system-packages \

git+https://github.com/mbriand/buildbot.git@mathieu/workers_limit#subdirectory=master \

git+https://github.com/mbriand/buildbot.git@mathieu/workers_limit#subdirectory=worker \

git+https://github.com/mbriand/buildbot.git@mathieu/workers_limit#subdirectory=pkg \

websockets \

&& \

git clone https://github.com/mbriand/buildbot.git -b mathieu/workers_limit && \

cd buildbot/ && \

make frontend_deps && \

pip3 install --break-system-packages pkg www/base www/console_view www/grid_view www/waterfall_view www/wsgi_dashboards www/badges

RUN ssh-keyscan push.yoctoproject.org push.openembedded.org >> /etc/ssh/ssh_known_hosts

Setup buildbot

COPY docker/yocto-autobuilder2_patches /yocto-autobuilder2_patches COPY . /yocto-autobuilder2 RUN useradd -m --system pokybuild &&
cd /home/pokybuild &&
buildbot create-master -r yocto-controller &&

cd yocto-controller &&
mv /yocto-autobuilder2 yoctoabb &&
git -C yoctoabb apply /yocto-autobuilder2_patches/*.patch &&
rm -rf /yocto-autobuilder2_patches &&
ln -rs yoctoabb/master.cfg master.cfg &&

cd /home/pokybuild &&
git clone https://git.yoctoproject.org/git/yocto-autobuilder-helper &&
pip install --break-system-packages
yocto-controller/yoctoabb/yocto_console_view/ &&
mkdir -p /home/pokybuild/git/ &&
mkdir -p /home/pokybuild/tmp/ &&
echo "[user]\nname=pokybuild\nemail=pokybuild@none\n" >
/home/pokybuild/.gitconfig &&
chown -R pokybuild:nogroup /home/pokybuild &&
mkdir -p /srv/autobuilder/ &&
chown -R pokybuild:nogroup /srv/autobuilder/

Fix config files for local runner

RUN sed -i
# Add local workers
-e "s/^workers_debian *=.*./\1 + [f"local-worker-debian"]/"
-e "s/^workers *=.*.
/\1 + [f"local-worker-extra-{i}" for i in range(1, 9)]/"
# Remove workers_bringup from all_workers
-e "/^all_workers =/s/workers_bringup + //"
# Switch from ssh:// URLS to git:// so we do not need any auth
-e "s#ssh://git@push.(yoctoproject.org|openembedded.org)/#git://git.\1/#"
# Change location of sharedrepodir and publish_dest directories
-e "s@^sharedrepodir *= *.
@\1"/sharedrepo"@"
-e "s@^publish_dest *= *.@\1"/publish"@"
# Use any worker for any release
-e '$ a workers_prev_releases = {}'
/home/pokybuild/yocto-controller/yoctoabb/config.py &&
sed -i
# Change location of sharedrepodir and publish_dest directories
-e "s#ssh://git@push.(yoctoproject.org|openembedded.org)/#git://git.\1/#"
/home/pokybuild/yocto-autobuilder-helper/config.json &&
sed -i
# imp was removed in python 3.12, switch to importlib
-e "s/^import imp$/import importlib as imp/"
# Fix own URL
-e "s@^c\['buildbotURL'\] *= *.
@\1"http://localhost:8010/"@"
/home/pokybuild/yocto-controller/master.cfg &&
# Comment any sched.Nightly schedulers
# We try to support multilines code blocks by counting parenthesis
awk -i inplace
'/^schedulers.append(sched.Nightly(/{comment=1} /(/{count+=gsub("\(", "(")} /)/{count-=gsub("\)", ")")} {if (comment) {print "#" $0} else {print} if (count==0) comment=0}'
/home/pokybuild/yocto-controller/yoctoabb/schedulers.py

COPY docker/entry.sh / RUN chmod a+x /entry.sh

ENTRYPOINT ["/entry.sh"]