package/skopeo: add target variant

Skopeo can be used to manipulate container images, and so can be useful
on target devices that are going to be used as a host to run containers.

So, add a target variant for skopeo.

... with a runtime test while at it.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Christian Stewart <christian@aperture.us>
Cc: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Yann E. MORIN
2025-03-15 20:57:03 +01:00
committed by Julien Olivain
parent c1add22462
commit 5c77357c58
4 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
import infra.basetest
import json
import os
class TestSkopeo(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_SYSTEM_DHCP="eth0"
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_SKOPEO=y
BR2_PACKAGE_HOST_GO_BIN=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv5",
kernel="builtin",
options=["-initrd", cpio_file, "-nic", "user,model=rtl8139"])
self.emulator.login()
self.assertRunOk("skopeo --version", timeout=30)
# First, check we can reach the default registry: docker.io
output, _ = self.emulator.run(
"skopeo inspect docker://busybox:latest",
timeout=60,
)
bb_info = json.loads("".join(output))
self.assertEqual(bb_info["Name"], "docker.io/library/busybox")
# Now, check we can reach an arbitrary registry: quay.io
output, _ = self.emulator.run(
"skopeo inspect docker://quay.io/quay/busybox:latest",
timeout=60,
)
skopeo_info = json.loads("".join(output))
self.assertEqual(skopeo_info["Name"], "quay.io/quay/busybox")