Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions create-image-util
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ create_flavor_image()
if [ $IMAGE_FLAVOR = "azure" ]; then
#build azure
exec_docker_cmd="$exec_docker_cmd create-azure --raw-image ${RAW_IMAGE}"
elif [ $IMAGE_FLAVOR = "iso" ]; then
#build iso
cd ${POI_PATH}/examples/${IMAGE_FLAVOR}
exec_docker_cmd="$exec_docker_cmd photon-iso-builder -f build-iso -v ${RELEASE_VERSION} -p ${KS_CONFIG_FILE}"
elif [ $IMAGE_FLAVOR = "ova" ]; then
#build ova
exec_docker_cmd="$exec_docker_cmd create-ova --installer-config ${KS_CONFIG_FILE} --ova-config ${OVA_CONFIG} --ova-name ${OVA_NAME} --raw-image ${RAW_IMAGE}"
Expand Down Expand Up @@ -236,6 +240,17 @@ usage() {
echo "create 4.0 RPI with remote repo"
echo "$0 --config-file rpi_ks.yaml --local-repo-path /home/dbx/poi/repo/4.0 --poi-path /home/dbx/workspace/poi_gitlab/photon-os-installer/ --flavor rpi --arch aarch64 --releasever 4.0 --src-repo-url=https://packages.vmware.com/photon/4.0/photon_updates_4.0_x86_64/"
echo "============================================================"
echo " create ISO image "
echo "============================================================"
echo "create 5.0 ISO"
echo "$0 --config-file packages_minimal.json --local-repo-path /home/dbx/poi/repo/5.0 --poi-path /home/dbx/workspace/poi_gitlab/photon-os-installer/ --flavor iso"
echo "-------------------------------------------------------------"
echo "create 4.0 ISO"
echo "$0 --config-file packages_minimal.json --local-repo-path /home/dbx/poi/repo/4.0 --poi-path /home/dbx/workspace/poi_gitlab/photon-os-installer/ --flavor iso --releasever 4.0"
echo "-------------------------------------------------------------"
echo "create 4.0 ISO with remote repo"
echo "$0 --config-file packages_minimal.json --local-repo-path /home/dbx/poi/repo/4.0 --poi-path /home/dbx/workspace/poi_gitlab/photon-os-installer/ --flavor iso --releasever 4.0 --src-repo-url=https://packages.vmware.com/photon/4.0/photon_updates_4.0_x86_64/"
echo "============================================================"

}

Expand Down Expand Up @@ -271,7 +286,7 @@ while true; do
done

if [ -z "${RAW_IMAGE}" ]; then
if [ $IMAGE_FLAVOR != "ami" -a $IMAGE_FLAVOR != "rpi" ] ; then
if [ $IMAGE_FLAVOR != "ami" -a $IMAGE_FLAVOR != "rpi" -a $IMAGE_FLAVOR != "iso" ] ; then
echo "raw image is missing" >&2
usage
echo "Terminating." >&2
Expand Down Expand Up @@ -327,9 +342,11 @@ fi
init_env

#Create repository and raw image
create_repo_and_raw_image
if [ ${IMAGE_FLAVOR} != "iso" ] ; then
create_repo_and_raw_image
fi

#Create final image
if [ ${IMAGE_FLAVOR} = "ova" -o ${IMAGE_FLAVOR} = "azure" ] ; then
if [ ${IMAGE_FLAVOR} = "ova" -o ${IMAGE_FLAVOR} = "azure" -o ${IMAGE_FLAVOR} = "iso" ] ; then
create_flavor_image
fi
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ FROM ${DOCKER_PROXY}library/photon:5.0 as poi-rpm-builder
ARG TDNF_OPTIONS

RUN tdnf ${TDNF_OPTIONS} makecache && \
tdnf ${TDNF_OPTIONS} -y install git rpm-build python3 createrepo
tdnf ${TDNF_OPTIONS} -y install git rpm-build python3 createrepo ca-certificates openssl

COPY --from=poi-helper / /photon-os-installer

Expand All @@ -61,7 +61,7 @@ RUN tdnf ${TDNF_OPTIONS} makecache && \
python3-rpm \
qemu-img \
open-vmdk ostree rpm-ostree \
stig-hardening \
stig-hardening ca-certificates openssl \
$([ "${TARGETARCH}" == "amd64" ] && echo grub2-pc) && \
rm -rf /var/cache/tdnf

Expand Down
15 changes: 13 additions & 2 deletions tests/poi-container-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
LOCAL_REPO_PATH = POI_TEST_PATH + "/repo"

BASE_COMMAND = f"{POI_PATH}/create-image-util --poi-path {POI_PATH} --local-repo-path"
IMAGE_FLAVOR = ["azure", "ova", "rpi", "ami"]
IMAGE_FLAVOR = ["azure", "ova", "rpi", "ami", "iso"]


def create_repo_path():
os.makedirs(LOCAL_REPO_PATH, exist_ok=True)


def remove_build_images(directory):
patterns = ["*.vhd.tar.gz", "*.ova", "*.ovf", "*.mf", "*.raw", "*.img", "poi-manifest.json"]
patterns = ["*.vhd.tar.gz", "*.ova", "*.ovf", "*.mf", "*.raw", "*.img"," *.iso", "poi-manifest.json"]

files = [file for pattern in patterns for file in glob.glob(f"{directory}/{pattern}")]
for file in files:
Expand Down Expand Up @@ -93,6 +93,11 @@ def test_build_ph5_local_ami_image(self):
subprocess.check_call(exec_command, shell = True)
assert(image_exist("ami", "photon-ami.raw") == True)

def test_build_ph5_local_iso_image(self):
exec_command = f"{BASE_COMMAND} {LOCAL_REPO_PATH}/5.0 --config-file packages_minimal.json --flavor iso"

subprocess.check_call(exec_command, shell = True)
assert(image_exist("iso", "something.iso") == True)
'''
def test_build_ph5_local_rpi_image(self):
exec_command = f"{BASE_COMMAND} {LOCAL_REPO_PATH}/5.0 --config-file rpi_ks.yaml --flavor rpi --arch aarch64"
Expand Down Expand Up @@ -138,9 +143,15 @@ def test_build_ph4_local_lvm_ova_image(self):

def test_build_ph4_local_ami_image(self):
exec_command = f"{BASE_COMMAND} {LOCAL_REPO_PATH}/4.0 --config-file ami_40_ks.yaml --flavor ami --releasever 4.0"

subprocess.check_call(exec_command, shell = True)
assert(image_exist("ami", "photon-ami-4.0.raw") == True)

def test_build_ph4_local_iso_image(self):
exec_command = f"{BASE_COMMAND} {LOCAL_REPO_PATH}/4.0 --config-file packages_minimal.json --flavor iso --releasever 4.0"

subprocess.check_call(exec_command, shell = True)
assert(image_exist("iso", "something.iso") == True)
'''
def test_build_ph4_local_rpi_image(self):
exec_command = f"{BASE_COMMAND} {LOCAL_REPO_PATH}/4.0 --config-file rpi_ks.yaml --flavor rpi --arch aarch64 --releasever 4.0"
Expand Down