Skip to content

Commit

Permalink
CI: update livecd testscases
Browse files Browse the repository at this point in the history
The livecd testcases were using the distributed bootkit to install
shim and kernel.  That can only work when we are using the same
keyset, which we no longer are.  Furthermore, bootkit layer no
longer ships kernel.efi at all, or signed shim.  So use the
bootkit from the keyset.

Also, drop the bootkit layer from livecd1.bats and from the
provisioning iso in livecd2.bats, as they're not needed
there.

Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
hallyn committed Sep 1, 2023
1 parent b711837 commit edc99dd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
8 changes: 0 additions & 8 deletions tests/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ function common_setup {
echo "ROOTFS_VERSION is ${ROOTFS_VERSION}"
export TOPDIR="$(git rev-parse --show-toplevel)"

# Support local testing
LOCAL_BOOTKIT_DIR="${TOPDIR}/../build-bootkit/oci"
if [ -d "${LOCAL_BOOTKIT_DIR}" ]; then
export BOOTKIT_URL="oci:${LOCAL_BOOTKIT_DIR}:bootkit-squashfs"
else
export BOOTKIT_URL="${BOOTKIT_URL:-docker://zothub.io/machine/bootkit/bootkit:$ROOTFS_VERSION-squashfs}"
fi

if [ ! -d "${PWD}/zothub" ]; then
stacker --oci-dir zothub build --layer-type squashfs
fi
Expand Down
7 changes: 0 additions & 7 deletions tests/livecd1/build-livecd-rfs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ targets:
nsgroup: "none"
network:
type: none
- service_name: bootkit
source: "$BOOTKIT_URL"
version: 1.0.0
service_type: fs-only
nsgroup: "none"
network:
type: none
EOF
if [ -n "$TLAYER" ]; then
cat >> manifest.yaml << EOF
Expand Down
8 changes: 7 additions & 1 deletion tests/livecd2.bats
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function teardown() {
--stacker-file ${ORIG}/tests/livecd2/stacker.yaml \
--substitute TMPD=${TMPD} \
--substitute TOPDIR=${TOPDIR} \
--substitute KEYSDIR=~/.local/share/machine/trust/keys/snakeoil \
--substitute "ZOT_VERSION=${ZOT_VERSION}" \
--substitute "ROOTFS_VERSION=${ROOTFS_VERSION}"
export PATH=${TMPD}:$PATH
Expand Down Expand Up @@ -99,18 +100,23 @@ EOF

# We've provisioned. Create install iso
./build-livecd-rfs --layer oci:oci:install-rootfs-squashfs \
--bootkit-layer oci:oci:bootkit-squashfs \
--output install.iso --tlayer oci:oci:target-rootfs-squashfs

echo "updating ${VMNAME} to boot from install.iso"
echo "yaml before:"
machine info "${VMNAME}"
cat > sed1.bash << EOF
#!/bin/bash
sed -i 's/provision.iso/install.iso/' \$*
# There has to be a better way than to delete 6 lines...
sed -i '/sudi.vfat/,+6d' \$*
sed -i '/sudi.vfat/,+3d' \$*
EOF
chmod 755 sed1.bash
VISUAL=$(pwd)/sed1.bash machine edit "${VMNAME}"
machine start "${VMNAME}"
wait_for_vm
echo "about to start provisioned machine to install"
machine info "${VMNAME}"
sleep 3s

Expand Down
14 changes: 11 additions & 3 deletions tests/livecd2/build-livecd-rfs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ usage() {
echo "Example usage: --project=snakeoil:default --layer=oci:oci:provision-rootfs-squashfs --output provision.iso --help"
echo " --project=snakeoil:default --layer=oci:oci:livecd-rootfs-squashfs --output livecd.iso --help"
echo " For an install cd, specify the target layer, e.g. --tlayer=oci:target-rootfs-squashfs"
echo " If installing, you'll want to specify a bootkit layer with --bootkit-layer"
}

short_opts="hp:l:t:o:"
long_opts="help,project:,layer:,tlayer:,output:"
short_opts="hp:b:l:t:o:"
long_opts="help,project:,bootkit-layer:,layer:,tlayer:,output:"
o=""
LAYER=""
TLAYER=""
OUTFILE="livecd.iso"
BLAYER=""
project=snakeoil:default
o=$(getopt --name "${0##*/}" --options "${short_opts}" \
--long "${long_opts}" -- "$@") && eval set -- "${o}" || { usage; exit 1; }
Expand All @@ -30,6 +32,7 @@ while [ $# -ne 0 ]; do
-h|--help) usage; exit 0;;
-p|--project) project="$next";;
-l|--layer) LAYER="$next";;
-b|--bootkit-layer) BLAYER="$next";;
-t|--tlayer) TLAYER="$next";;
-o|--output) OUTFILE="$next";;
--) shift; break;;
Expand Down Expand Up @@ -72,14 +75,19 @@ targets:
nsgroup: "none"
network:
type: none
EOF

if [ -n "$BLAYER" ]; then
cat >> manifest.yaml << EOF
- service_name: bootkit
source: "$BOOTKIT_URL"
source: "$BLAYER"
version: 1.0.0
service_type: fs-only
nsgroup: "none"
network:
type: none
EOF
fi
if [ -n "$TLAYER" ]; then
cat >> manifest.yaml << EOF
- service_name: hostfs
Expand Down
9 changes: 9 additions & 0 deletions tests/livecd2/stacker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ target-rootfs:
systemctl enable serial-getty@ttyS0
bootkit:
from:
type: scratch
import:
- path: ${{KEYSDIR}}/bootkit/kernel.efi
dest: /bootkit/kernel.efi
- path: ${{KEYSDIR}}/bootkit/shim.efi
dest: /bootkit/shim.efi

install-rootfs:
from:
type: built
Expand Down

0 comments on commit edc99dd

Please sign in to comment.