mirror of
https://github.com/cockpit-project/cockpit.git
synced 2026-11-03 21:49:50 -09:00
test: Add bootc image preparation
We want to test deploying cockpit rpms in bootc images. This will prevent hiccups like https://github.com/cockpit-project/cockpit/issues/21201 in the future and also test a lot of OS subsystems. The centos-9-bootc bots image includes its own deployment container image, so we can easily derive an image with our locally built RPMs included. https://issues.redhat.com/browse/COCKPIT-1237
This commit is contained in:
parent
850b011f30
commit
762c350096
2 changed files with 46 additions and 0 deletions
25
test/bootc.install
Normal file
25
test/bootc.install
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
set -eux
|
||||
|
||||
cd /var/tmp/
|
||||
|
||||
# bootc images have their own deployed image in a local registry
|
||||
podman run -d --rm --name ostree-registry -p 5000:5000 -v /var/lib/cockpit-test-registry/:/var/lib/registry localhost/test-registry
|
||||
|
||||
# build updated bootc image with our RPMs
|
||||
podman build -t localhost/bootc-test --layers=false -f - . <<EOF
|
||||
FROM localhost:5000/bootc:latest
|
||||
COPY ./rpms /tmp/rpms
|
||||
RUN rpm --upgrade --verbose /tmp/rpms/*.rpm && rm -r /tmp/rpms
|
||||
COPY ./playground /usr/share/cockpit/playground
|
||||
EOF
|
||||
|
||||
# deploy it
|
||||
bootc switch --transport containers-storage localhost/bootc-test
|
||||
|
||||
# clean up
|
||||
podman rm -ft0 ostree-registry
|
||||
podman rmi localhost:5000/bootc localhost/bootc-test
|
||||
|
||||
# ensure that we don't accidentally test with container
|
||||
podman rmi quay.io/cockpit/ws:latest
|
||||
|
|
@ -165,6 +165,25 @@ def build_install_ostree(dist_tar, image, verbose, quick):
|
|||
return args
|
||||
|
||||
|
||||
def build_install_bootc(dist_tar, image, verbose, quick):
|
||||
"""Special treatment of build/install on Bootc
|
||||
|
||||
bootc image can't build packages, build them on corresponding OSes, build a new bootc
|
||||
image with the rpms, and deploy it.
|
||||
"""
|
||||
with create_machine(testmap.get_build_image(image)) as machine:
|
||||
rpms = build_rpms(dist_tar, machine, verbose, quick)
|
||||
args = ["--run-command", "mkdir -p /var/tmp/rpms"]
|
||||
for rpm in rpms:
|
||||
if not any(r in rpm for r in [".src", "debug", "packagekit", "storaged"]):
|
||||
args += ["--upload", f"{rpm}:/var/tmp/rpms/"]
|
||||
args += [
|
||||
"--upload", os.path.join(BASE_DIR, "dist/playground") + ":/var/tmp/",
|
||||
"--script", os.path.join(TEST_DIR, "bootc.install"),
|
||||
]
|
||||
return args
|
||||
|
||||
|
||||
def build_install_container(dist_tar, image, verbose, quick):
|
||||
"""Build VM with cockpit/ws container
|
||||
|
||||
|
|
@ -253,6 +272,8 @@ def main():
|
|||
|
||||
if args.image == "fedora-coreos":
|
||||
customize += build_install_ostree(dist_tar, args.image, args.verbose, args.quick)
|
||||
elif args.image.endswith("-bootc"):
|
||||
customize += build_install_bootc(dist_tar, args.image, args.verbose, args.quick)
|
||||
elif args.container:
|
||||
customize += build_install_container(dist_tar, args.image, args.verbose, args.quick)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue