dustin
/
jenkinsagent
Archived
1
0
Fork 0
Buildroot configuration for network-booted Jenkins agent system.
This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
Go to file
Dustin c59e9de714 rootfs: Persistent storage for Jenkins, Docker
Docker and Jenkins need more storage than is available in the *tmpfs*
filesystem mounted at `/var`.  We can use NBD to provide additional
storage volumes for these paths.

The `nbd@.service` systemd unit, which is included in the *nbd* package
but not actually installed by it, starts an NBD client, using the
configuration in `/etc/nbdtab` for the specified block device.  To avoid
hard-coding the NBD server name here, the file included in the rootfs
image is actually a template.  This template is rendered at boot time,
using the same server name specified on the kernel command line for the
rootfs device.  Obviously, this implies that the same server has to host
both the rootfs image and the persistent storage, but that is not likely
to be a problem for this project.

To allow multiple devices to use the same rootfs image but separate
persistent storage devices, the `nbdtab` template can include a
placeholder for the device's serial number.  This only works for
Raspberry Pi devices, of course, but the concept could be extended to
other device types by adding more placeholders for other
machine-specific properties (e.g. DMI UUID, etc.)

Since `/var/lib/jenkins` is the home directory for the *jenkins* user,
and thus the location of its `~/.ssh/authorized_keys` file, we have to
make sure the *fetch-sshkeys@jenkins.service* unit does not start until
the persistent storage volume is mounted.  We also need a service unit
that ensures the permissions of the mount point are correct,
particularly for the first boot when the filesystem is initially
created.

Similarly, we have to ensure that the Docker daemon does not start until
`/var/lib/docker` is mounted.  Adding a `RequiresMountsFor=` property to
the *docker.service* unit generates the necessary dependencies to
accomplish this.
2022-03-15 14:18:29 -05:00
configs rootfs: Persistent storage for Jenkins, Docker 2022-03-15 14:18:29 -05:00
initramfs initramfs: Mount proc et al. earlier 2022-03-12 16:04:58 -06:00
rootfs rootfs: Persistent storage for Jenkins, Docker 2022-03-15 14:18:29 -05:00
.gitignore Initial commit 2022-03-09 00:27:30 -06:00
Config.in Initial commit 2022-03-09 00:27:30 -06:00
README.md Initial commit 2022-03-09 00:27:30 -06:00
cmdline.txt Use NBD server on pxe0 2022-03-15 14:18:29 -05:00
config.txt Initial commit 2022-03-09 00:27:30 -06:00
external.desc Initial commit 2022-03-09 00:27:30 -06:00
external.mk Initial commit 2022-03-09 00:27:30 -06:00

README.md

Network-Booted Jenkins Agent

Required Build Host Configuration

sudo dnf install -y \
	ncurses-devel \
	perl-ExtUtils-MakeMaker \
	perl-FindBin \
	perl-Thread-Queue \
	--
git clone git://git.buildroot.net/buildroot ~/src/buildroot

Build

Build the Initramfs

make -C ~/src/buildroot O=${PWD}/_build/initramfs BR2_EXTERNAL=${PWD} jenkinsagent_initramfs_defconfig
make -C _build/initramfs -j $(nproc)

Build the Rootfs

make -C ~/src/buildroot O=${PWD}/_build/rootfs BR2_EXTERNAL=${PWD} jenkinsagent_defconfig
make -C _build/rootfs -j $(nproc)