From d028b28d63d6a594d33946a9ff9a843e58c8a98c Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Sat, 12 Nov 2022 12:04:52 -0500 Subject: [PATCH] beginning work on downloading variant images --- iso/empanadas/empanadas/common.py | 6 +-- iso/empanadas/empanadas/configs/el8.yaml | 10 ++++ iso/empanadas/empanadas/util/iso_utils.py | 56 +++++++++++++---------- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/iso/empanadas/empanadas/common.py b/iso/empanadas/empanadas/common.py index 56c0942..71d6e0f 100644 --- a/iso/empanadas/empanadas/common.py +++ b/iso/empanadas/empanadas/common.py @@ -103,10 +103,10 @@ for conf in glob.iglob(f"{_rootdir}/sig/*.yaml"): ALLOWED_TYPE_VARIANTS = { - "Azure": None, + "Azure": ["Base", "LVM"], "Container": ["Base", "Minimal", "UBI"], - "EC2": None, - "GenericCloud": None, + "EC2": ["Base", "LVM"], + "GenericCloud": ["Base", "LVM"], "Vagrant": ["Libvirt", "Vbox"], "OCP": None } diff --git a/iso/empanadas/empanadas/configs/el8.yaml b/iso/empanadas/empanadas/configs/el8.yaml index 0a0f3bf..4b11031 100644 --- a/iso/empanadas/empanadas/configs/el8.yaml +++ b/iso/empanadas/empanadas/configs/el8.yaml @@ -74,10 +74,20 @@ - 'xorriso' cloudimages: images: + Azure: + format: vhd + variants: [Base, LVM] EC2: format: raw + variants: [Base, LVM] GenericCloud: format: qcow2 + variants: [Base, LVM] + Container: + format: tar.xz + variants: [Base, Minimal, UBI] + OCP: + format: qcow2 livemap: git_repo: 'https://git.resf.org/sig_core/kickstarts.git' branch: 'r8' diff --git a/iso/empanadas/empanadas/util/iso_utils.py b/iso/empanadas/empanadas/util/iso_utils.py index 85757b0..ea56ce3 100644 --- a/iso/empanadas/empanadas/util/iso_utils.py +++ b/iso/empanadas/empanadas/util/iso_utils.py @@ -1361,29 +1361,37 @@ class IsoBuild: unpack_single_arch = True arches_to_unpack = [self.arch] - for imagename in self.cloudimages['images']: - self.log.info(Color.INFO + 'Determining the latest images for ' + imagename + ' ...') - formattype = self.cloudimages['images'][imagename]['format'] + for name, extra in self.cloudimages['images'].items(): + self.log.info(Color.INFO + 'Determining the latest images for ' + name + ' ...') + formattype = extra['format'] - if self.s3: - latest_artifacts = Shared.s3_determine_latest( - self.s3_bucket, - self.release, - arches_to_unpack, - formattype, - imagename, - self.log - ) + variants = extra['variants'] if 'variants' in extra.keys() else [None] # need to loop once + latest_artifacts = [] - else: - latest_artifacts = Shared.reqs_determine_latest( - self.s3_bucket_url, - self.release, - arches_to_unpack, - formattype, - imagename, - self.log - ) + for variant in variants: + if variant: + name = f"{name}-{variant}" + if self.s3: + latest_artifacts.append(Shared.s3_determine_latest( + self.s3_bucket, + self.release, + arches_to_unpack, + formattype, + name, + self.log + )) + + else: + latest_artifacts.append(Shared.reqs_determine_latest( + self.s3_bucket_url, + self.release, + arches_to_unpack, + formattype, + name, + self.log + )) + + # latest_artifacts should have at least 1 result if has_variants, else == 1 if not len(latest_artifacts) > 0: self.log.warn(Color.WARN + 'No images found.') @@ -1397,7 +1405,7 @@ class IsoBuild: ) if arch not in latest_artifacts.keys(): - self.log.warn(Color.WARN + 'Artifact for ' + imagename + + self.log.warn(Color.WARN + 'Artifact for ' + name + ' ' + arch + ' (' + formattype + ') does not exist.') continue @@ -1449,7 +1457,7 @@ class IsoBuild: image_arch_dir, self.shortname, self.major_version, - imagename, + name, arch, formattype ) @@ -1458,7 +1466,7 @@ class IsoBuild: image_arch_dir, self.shortname, self.major_version, - imagename, + name, arch, formattype )