Skip to content

Commit

Permalink
test: add custom partitions to raw image
Browse files Browse the repository at this point in the history
  • Loading branch information
mcattamoredhat committed Apr 18, 2024
1 parent 6fdbde4 commit bc3cc3c
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 1 deletion.
19 changes: 19 additions & 0 deletions test/cases/ostree-ami-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ OSTREE_OSNAME=redhat
BUCKET_NAME="composer-ci-${TEST_UUID}"
BUCKET_URL="s3://${BUCKET_NAME}"
OBJECT_URL="http://${BUCKET_NAME}.s3.${AWS_DEFAULT_REGION}.amazonaws.com"
CUSTOM_FS_LVS="false"

# Set up temporary files.
TEMPDIR=$(mktemp -d)
Expand Down Expand Up @@ -93,10 +94,12 @@ case "${ID}-${VERSION_ID}" in
"rhel-9."*)
OSTREE_REF="rhel/9/${ARCH}/edge"
SYSROOT_RO="true"
CUSTOM_FS_LVS="true"
;;
"centos-9")
OSTREE_REF="centos/9/${ARCH}/edge"
SYSROOT_RO="true"
CUSTOM_FS_LVS="true"
;;
*)
redprint "unsupported distro: ${ID}-${VERSION_ID}"
Expand Down Expand Up @@ -611,6 +614,20 @@ groups = ["wheel"]
url = "${OBJECT_URL}/config.ign"
EOF

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 aws ami blueprint"
cat "$BLUEPRINT_FILE"

Expand Down Expand Up @@ -880,6 +897,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e ostree_commit="${INSTALL_HASH}" \
-e sysroot_ro="$SYSROOT_RO" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -1058,6 +1076,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e ostree_commit="${UPGRADE_HASH}" \
-e sysroot_ro="$SYSROOT_RO" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down
23 changes: 23 additions & 0 deletions test/cases/ostree-raw-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ KERNEL_RT_PKG="kernel-rt"
# Set up variables.
SYSROOT_RO="false"
CUSTOM_DIRS_FILES="false"
CUSTOM_FS_LVS="false"

# Set FIPS variable default
FIPS="${FIPS:-false}"
Expand All @@ -114,6 +115,7 @@ case "${ID}-${VERSION_ID}" in
PARENT_REF="rhel/9/${ARCH}/edge"
OS_VARIANT="rhel9-unknown"
SYSROOT_RO="true"
CUSTOM_FS_LVS="true"
;;
"centos-8")
OSTREE_REF="centos/8/${ARCH}/edge"
Expand All @@ -127,6 +129,7 @@ case "${ID}-${VERSION_ID}" in
OS_VARIANT="centos-stream9"
BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no"
SYSROOT_RO="true"
CUSTOM_FS_LVS="true"
;;
"fedora-"*)
CONTAINER_TYPE=iot-container
Expand Down Expand Up @@ -471,6 +474,22 @@ enabled = ["custom.service"]
EOF
fi

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 raw image blueprint"
cat "$BLUEPRINT_FILE"

Expand Down Expand Up @@ -583,6 +602,7 @@ EOF
-e sysroot_ro="$SYSROOT_RO" \
-e test_custom_dirs_files="$CUSTOM_DIRS_FILES" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -751,6 +771,7 @@ EOF
-e sysroot_ro="$SYSROOT_RO" \
-e test_custom_dirs_files="$CUSTOM_DIRS_FILES" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0

check_result
Expand Down Expand Up @@ -857,6 +878,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e test_custom_dirs_files="$CUSTOM_DIRS_FILES" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -1049,6 +1071,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e test_custom_dirs_files="$CUSTOM_DIRS_FILES" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down
64 changes: 64 additions & 0 deletions test/cases/ostree-simplified-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ INSTALLER_FILENAME=simplified-installer.iso
MEMORY=2048
BOOT_ARGS="uefi"
REF_PREFIX="rhel-edge"
CUSTOM_FS_LVS="false"

# Set up temporary files.
TEMPDIR=$(mktemp -d)
Expand Down Expand Up @@ -142,6 +143,7 @@ case "${ID}-${VERSION_ID}" in
SYSROOT_RO="true"
ANSIBLE_USER=fdouser
FDO_USER_ONBOARDING="true"
CUSTOM_FS_LVS="true"
# workaround selinux bug https://bugzilla.redhat.com/show_bug.cgi?id=2026795
sudo setenforce 0
getenforce
Expand All @@ -160,6 +162,7 @@ case "${ID}-${VERSION_ID}" in
SYSROOT_RO="true"
ANSIBLE_USER=fdouser
FDO_USER_ONBOARDING="true"
CUSTOM_FS_LVS="true"
# workaround selinux bug https://bugzilla.redhat.com/show_bug.cgi?id=2026795
sudo setenforce 0
getenforce
Expand Down Expand Up @@ -459,6 +462,20 @@ fips = ${FIPS}
EOF
fi

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 simplified_iso_without_fdo blueprint"
cat "$BLUEPRINT_FILE"

Expand Down Expand Up @@ -565,6 +582,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e fdo_credential="false" \
-e sysroot_ro="$SYSROOT_RO" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -625,6 +643,19 @@ append = "enforcing=0"
EOF
fi

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 installer blueprint"
cat "$BLUEPRINT_FILE"
Expand Down Expand Up @@ -753,6 +784,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e mfg_guest_int_name="${MFG_GUEST_INT_NAME}" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -810,6 +842,20 @@ append = "enforcing=0"
EOF
fi

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 fdosshkey blueprint"
cat "$BLUEPRINT_FILE"

Expand Down Expand Up @@ -939,6 +985,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e mfg_guest_int_name="${MFG_GUEST_INT_NAME}" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -1078,6 +1125,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e mfg_guest_int_name="${MFG_GUEST_INT_NAME}" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0

check_result
Expand Down Expand Up @@ -1143,6 +1191,20 @@ append = "enforcing=0"
EOF
fi

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 fdosshkey blueprint"
cat "$BLUEPRINT_FILE"

Expand Down Expand Up @@ -1253,6 +1315,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e mfg_guest_int_name="${MFG_GUEST_INT_NAME}" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -1396,6 +1459,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e sysroot_ro="$SYSROOT_RO" \
-e mfg_guest_int_name="${MFG_GUEST_INT_NAME}" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0

check_result
Expand Down
19 changes: 19 additions & 0 deletions test/cases/ostree-vsphere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ CONTAINER_TYPE=edge-container
CONTAINER_FILENAME=container.tar
VSPHERE_IMAGE_TYPE=edge-vsphere
VSPHERE_FILENAME=image.vmdk
CUSTOM_FS_LVS="false"

# Set up temporary files.
TEMPDIR=$(mktemp -d)
Expand Down Expand Up @@ -110,10 +111,12 @@ case "${ID}-${VERSION_ID}" in
"rhel-9"* )
OSTREE_REF="rhel/9/${ARCH}/edge"
GUEST_ID_DC70="rhel9_64Guest"
CUSTOM_FS_LVS="true"
;;
"centos-9")
OSTREE_REF="centos/9/${ARCH}/edge"
GUEST_ID_DC70="centos9_64Guest"
CUSTOM_FS_LVS="true"
;;
*)
echo "unsupported distro: ${ID}-${VERSION_ID}"
Expand Down Expand Up @@ -455,6 +458,20 @@ groups = ["wheel"]
url = "${IGNITION_SERVER_URL}/config.ign"
EOF

if [[ "${CUSTOM_FS_LVS}" == "true" ]]; then
tee -a "$BLUEPRINT_FILE" > /dev/null << EOF
[[customizations.filesystem]]
mountpoint = "/foo/bar"
size=2147483648
[[customizations.filesystem]]
mountpoint = "/foo"
size=8589934592
[[customizations.filesystem]]
mountpoint = "/var/myfiles"
size= "1 GiB"
EOF
fi

greenprint "📄 vmdk blueprint"
cat "$BLUEPRINT_FILE"

Expand Down Expand Up @@ -543,6 +560,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e fdo_credential="false" \
-e sysroot_ro="$SYSROOT_RO" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0
check_result

Expand Down Expand Up @@ -677,6 +695,7 @@ sudo ansible-playbook -v -i "${TEMPDIR}"/inventory \
-e fdo_credential="false" \
-e sysroot_ro="$SYSROOT_RO" \
-e fips="${FIPS}" \
-e custom_fs_lvs="${CUSTOM_FS_LVS}" \
/usr/share/tests/osbuild-composer/ansible/check_ostree.yaml || RESULTS=0

check_result
Expand Down
Loading

0 comments on commit bc3cc3c

Please sign in to comment.