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 #452
  • Loading branch information
martinpitt committed Jul 23, 2020
1 parent cd78326 commit a0abe9f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,19 @@ rpm: dist-gzip $(RPM_NAME).spec
rm -r "`pwd`/rpmbuild"
rm -r "`pwd`/output" "`pwd`/build"

# build a VM with locally built rpm installed
$(VM_IMAGE): rpm bots
# determine what to depend on and do for Fedora/RHEL/Debian VM preparation
ifneq ($(filter debian-%,$(TEST_OS)),)
VM_DEP=dist-gzip packaging/debian/rules packaging/debian/control
VM_PACKAGE=--upload `pwd`/cockpit-$(PACKAGE_NAME)-$(VERSION).tar.gz:/var/tmp/ --upload `pwd`/packaging/debian:/var/tmp/
else
VM_DEP=rpm
VM_PACKAGE=--install `pwd`/$(RPM_NAME)-*.noarch.rpm
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`/$(RPM_NAME)-*.noarch.rpm -s $(CURDIR)/test/vm.install $(TEST_OS)
bots/image-customize -v -i cockpit-ws -i cockpit-system $(VM_PACKAGE) -s $(CURDIR)/test/vm.install $(TEST_OS)

# convenience target for the above
vm: $(VM_IMAGE)
Expand Down
41 changes: 40 additions & 1 deletion test/vm.install
Original file line number Diff line number Diff line change
@@ -1,8 +1,47 @@
#!/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
# HACK: enable Debian unstable until podman 2.0 is in testing
echo 'deb http://deb.debian.org/debian unstable main' > /etc/apt/sources.list.d/unstable.list
apt-get update
eatmydata apt-get install -y 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)
(cd /lib/systemd/user
curl -O https://raw.githubusercontent.com/containers/podman/master/contrib/systemd/user/podman.service
curl -O https://raw.githubusercontent.com/containers/podman/master/contrib/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 a0abe9f

Please sign in to comment.