Skip to content

Commit

Permalink
Support debian-testing test VM
Browse files Browse the repository at this point in the history
- Adjust the `make vm` rule to pull in the rpm or deb bits depending on
  `$TEST_OS`.

- Adjust test/vm.install to build Debian source and binary packages,
  and install it from there.

- Enable user namespaces in the kernel.

This still requires a good deal of bug workarounds.

Closes cockpit-project#452
  • Loading branch information
martinpitt committed Jul 29, 2020
1 parent 5af522f commit d2712b2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,19 @@ $(RPMFILE): $(TARFILE) $(RPM_NAME).spec
# sanity check
test -e "$(RPMFILE)"

# build a VM with locally built rpm installed
$(VM_IMAGE): $(RPMFILE) bots
# determine what to depend on and do for Fedora/RHEL/Debian VM preparation
ifneq ($(filter debian-%,$(TEST_OS)),)
VM_DEP=$(TARFILE) packaging/debian/rules packaging/debian/control
VM_PACKAGE=--upload `pwd`/$(TARFILE):/var/tmp/ --upload `pwd`/packaging/debian:/var/tmp/
else
VM_DEP=$(RPMFILE)
VM_PACKAGE=--install cockpit-ws --install `pwd`/$(RPMFILE)
endif

# build a VM with locally built rpm/dsc installed
$(VM_IMAGE): $(VM_DEP) bots
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
bots/image-customize -v -i cockpit-ws -i `pwd`/$(RPMFILE) -s $(CURDIR)/test/vm.install $(TEST_OS)
bots/image-customize -v $(VM_PACKAGE) -s $(CURDIR)/test/vm.install $(TEST_OS)

# convenience target for the above
vm: $(VM_IMAGE)
Expand Down
38 changes: 37 additions & 1 deletion test/vm.install
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
#!/bin/sh
# image-customize script to enable cockpit in test VMs
# The application RPM will be installed separately
set -eu

# for Debian based images, build and install debs; for RPM based ones, the locally built rpm gets installed separately
if [ -d /var/tmp/debian ]; then
apt-get update
eatmydata apt-get install -y cockpit-ws cockpit-system podman

# HACK: starting podman.service complains about missing crun: https://bugs.debian.org/961016
eatmydata apt-get install -y crun

# HACK: deb is not yet shipping the REST and user units: https://bugs.debian.org/966118
(cd /lib/systemd/system
curl -O https://raw.githubusercontent.com/containers/podman/master/contrib/systemd/system/podman.service
curl -O https://raw.githubusercontent.com/containers/podman/master/contrib/systemd/system/podman.socket
ln -s ../system/podman.service /lib/systemd/user/podman.service
ln -s ../system/podman.socket /lib/systemd/user/podman.socket)

# build source package
cd /var/tmp
TAR=$(ls cockpit-podman-*.tar.gz)
VERSION="${TAR#cockpit-podman-}"
VERSION="${VERSION%.tar.gz}"
ln -s $TAR cockpit-podman_${VERSION}.orig.tar.gz
tar xf "$TAR"
cd cockpit-podman
cp -r ../debian .
sed -i "s/(0-1)/(${VERSION}-1)/" debian/changelog
dpkg-buildpackage -S -us -uc -nc
cd ..

# build and install binary package
pbuilder build --buildresult . *.dsc
dpkg -i *.deb

# Debian does not enable user namespaces by default
echo kernel.unprivileged_userns_clone = 1 > /etc/sysctl.d/00-local-userns.conf
systemctl restart systemd-sysctl
fi

systemctl enable cockpit.socket podman.socket

# don't force https:// (self-signed cert)
Expand Down

0 comments on commit d2712b2

Please sign in to comment.