From 952ad8acf18260d4a6a21238de064dfbe19aab64 Mon Sep 17 00:00:00 2001 From: Gustavo Pichorim Boiko Date: Fri, 13 Dec 2024 19:29:23 +0000 Subject: [PATCH] Look for images and sbom assets also in the iso/ folder After the latest changes of product-composer (allowing to build isos with different names than ftp trees), the sbom assets are no longer saved in the root of the repo (as they are for SLFO 1.0) and now live in the iso folder as well. So look for those assets in both places. --- gocd/rabbit-openqa.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gocd/rabbit-openqa.py b/gocd/rabbit-openqa.py index 78f420d1e..b3059d332 100755 --- a/gocd/rabbit-openqa.py +++ b/gocd/rabbit-openqa.py @@ -63,24 +63,24 @@ def map_iso(self, staging_project, iso): def gather_isos(self, name, repository): iso_set = set() - # Fetch /published/prj/repo/iso/*.iso - url = self.api.makeurl(['published', name, repository, 'iso']) - f = self.api.retried_GET(url) - root = ET.parse(f).getroot() - for entry in root.findall('entry'): - if entry.get('name').endswith('.iso'): - iso_set.add(self.map_iso(name, entry.get('name'))) - - # Fetch /published/prj/repo/*.{qcow2,raw.xz,spdx.json} - url = self.api.makeurl(['published', name, repository]) - f = self.api.retried_GET(url) - root = ET.parse(f).getroot() - for entry in root.findall('entry'): - filename = entry.get('name') - if (filename.endswith('.qcow2') or - filename.endswith('.raw.xz') or - filename.endswith('.spdx.json')): - iso_set.add(self.map_iso(name, filename)) + # Look for .iso and other images/sbom assets in the repository root and in the + # iso sub-folder of /published/prj/repo/ + places = ( + ['published', name, repository, 'iso'], + ['published', name, repository], + ) + for place in places: + url = self.api.makeurl(place) + f = self.api.retried_GET(url) + root = ET.parse(f).getroot() + + for entry in root.findall('entry'): + filename = entry.get('name') + if (filename.endswith('.qcow2') or + filename.endswith('.raw.xz') or + filename.endswith('.spdx.json') or + filename.endswith('.iso')): + iso_set.add(self.map_iso(name, filename)) # Filter out isos which couldn't be mapped return [iso for iso in iso_set if iso]