2023-02-15 09:07:58 +00:00
|
|
|
#!/usr/bin/bash
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
MANIFESTS_DIR=$1
|
|
|
|
# check that MANIFESTS_DIR is a directory
|
|
|
|
if [ ! -d "$MANIFESTS_DIR" ]; then
|
|
|
|
echo "Error: $MANIFESTS_DIR is not a directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ensure that we are running on x86_64 architecture
|
|
|
|
if [ "$(uname -m)" != "x86_64" ]; then
|
|
|
|
echo "Error: this script is only supported on x86_64 architecture"
|
2024-07-23 14:40:58 +00:00
|
|
|
# NB: we are not failing here, because Testing Farm ignores the 'arch' field in the test plan spec
|
|
|
|
# See https://docs.testing-farm.io/Testing%20Farm/0.1/test-request.html#architectures
|
|
|
|
exit 0
|
2023-02-15 09:07:58 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
. /etc/os-release
|
|
|
|
|
|
|
|
case "${ID}-${VERSION_ID}" in
|
2023-02-15 13:36:11 +00:00
|
|
|
fedora-*)
|
2023-02-15 09:07:58 +00:00
|
|
|
IMAGE_MANIFEST="${MANIFESTS_DIR}/fedora.json"
|
|
|
|
;;
|
2023-02-15 13:36:11 +00:00
|
|
|
rhel-8.*)
|
2023-02-15 09:07:58 +00:00
|
|
|
IMAGE_MANIFEST="${MANIFESTS_DIR}/rhel-8.json"
|
|
|
|
;;
|
2023-02-15 13:36:11 +00:00
|
|
|
rhel-9.*)
|
2023-02-15 09:07:58 +00:00
|
|
|
IMAGE_MANIFEST="${MANIFESTS_DIR}/rhel-9.json"
|
|
|
|
;;
|
2023-02-15 13:36:11 +00:00
|
|
|
centos-8)
|
2023-02-15 09:07:58 +00:00
|
|
|
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-8.json"
|
|
|
|
;;
|
2023-02-15 13:36:11 +00:00
|
|
|
centos-9)
|
2023-02-15 09:07:58 +00:00
|
|
|
IMAGE_MANIFEST="${MANIFESTS_DIR}/centos-9.json"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Error: unsupported OS: ${ID}-${VERSION_ID}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
OUTPUT_DIR=/var/tmp/osbuild-output
|
|
|
|
STORE_DIR=/var/tmp/osbuild-store
|
|
|
|
sudo mkdir -p "${OUTPUT_DIR}"
|
|
|
|
sudo mkdir -p "${STORE_DIR}"
|
|
|
|
|
|
|
|
# all the images are built with qcow2 format, so export it
|
|
|
|
EXPORT_PIPELINE="qcow2"
|
|
|
|
|
|
|
|
sudo osbuild --output-directory "${OUTPUT_DIR}" --store "${STORE_DIR}" --export "${EXPORT_PIPELINE}" "${IMAGE_MANIFEST}"
|