Skip to content
Merged
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
17 changes: 12 additions & 5 deletions script/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ def rsync_commands(checksum):
break
fi
done
[ -n "$folder" ] || continue
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src /var/lib/openqa/factory/hdd/"
if [[ $src =~ .iso$ ]]; then
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src /var/lib/openqa/factory/iso/"
else
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src /var/lib/openqa/factory/hdd/"
fi
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src.sha256 /var/lib/openqa/factory/other/"
echo ""
done < <(grep ${arch} __envsub/files_iso.lst | sort)
Expand Down Expand Up @@ -282,11 +285,15 @@ def openqa_call_start_ex(checksum):
break
fi
done
[ -n "$folder" ] || continue
n=$((i++))
echo " ASSET_$((n+255))=$src.sha256 \\\\"
echo " HDD_$n=$src \\\\"
echo " CHECKSUM_HDD_$n=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\"
if [[ $src =~ .iso$ ]]; then
echo " ISO=$src \\\\"
echo " CHECKSUM_ISO=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\"
else
echo " HDD_$n=$src \\\\"
echo " CHECKSUM_HDD_$n=\$(cut -b-64 /var/lib/openqa/factory/other/$src.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\"
fi
done < <(grep ${arch} __envsub/files_iso.lst | sort)
'''

Expand Down
32 changes: 26 additions & 6 deletions script/scriptgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def __init__(self, name, actionGenerator):
self.meta_variables = "_OBSOLETE=1"
if self.ag.brand != "obs" and not self.ag.staging():
self.meta_variables = "_DEPRIORITIZEBUILD=1"
self.offset = 1

def productpath(self):
if self.dist_path:
Expand Down Expand Up @@ -348,6 +349,8 @@ def doFlavor(self, node):
self.distri = node.attrib["distri"]
if node.attrib.get("legacy_builds", ""):
self.legacy_builds = node.attrib["legacy_builds"]
if node.attrib.get("offset", ""):
self.offset = node.attrib["offset"]

for t in node.findall(".//repos"):
if t.attrib.get("archs", ""):
Expand Down Expand Up @@ -400,6 +403,11 @@ def doFlavor(self, node):
self.asset_folders[t.attrib["filemask"]] = assets_folder

for t in node.findall(".//*"):
if t.tag == "iso":
self.isos.append(t.attrib["filemask"])
if t.attrib.get("folder", ""):
self.iso_folder[t.attrib["filemask"]] = t.attrib["folder"]
self.hdd_folder[t.attrib["filemask"]] = t.attrib["folder"]
if t.tag == "hdd":
self.hdds.append(t.attrib["filemask"])
if node.attrib.get("folder", ""):
Expand Down Expand Up @@ -522,7 +530,19 @@ def gen_read_files(self, f):
self.p(cfg.read_files_isos, f)
else:
for iso in self.isos:
self.p(cfg.read_files_iso, f, "FOLDER", self.iso_folder.get(iso, ""), "SRCISO", iso)
if "*" in iso:
self.p(
cfg.read_files_iso,
f,
"FOLDER",
self.iso_folder.get(iso, ""),
"SRCISO",
"",
"Media1?.iso$",
iso,
)
else:
self.p(cfg.read_files_iso, f, "FOLDER", self.iso_folder.get(iso, ""), "SRCISO", iso)

if self.repolink:
self.p(cfg.read_files_repo_link, f)
Expand Down Expand Up @@ -664,7 +684,7 @@ def gen_print_array_flavor_filter(self, f):
if not self.isos and not self.hdds:
for fl, h in zip(self.flavors, self.assets):
self.p("flavor_filter[{}]='{}'".format(fl, h), f)
if not self.assets and not self.hdds:
if not self.assets and ((not self.hdds) or len(self.flavors) == 1):
for fl, iso in zip(self.flavors, self.isos):
if iso != "1" and iso != "0" and iso != "extract_as_repo":
if not added_declare_flavor_filter:
Expand All @@ -691,7 +711,7 @@ def gen_print_array_iso_folder(self, f):
self.p("iso_folder[{}]='{}/'".format(k, v), f)

def gen_print_array_hdd_folder(self, f):
if len(self.hdd_folder) > 1 and not self.isos and len(self.flavors) == 1:
if ((len(self.hdd_folder) > 1) or (self.hdd_folder and self.isos)) and len(self.flavors) == 1:
self.p("declare -A hdd_folder", f)
for k, v in self.hdd_folder.items():
self.p("hdd_folder[{}]='{}'".format(k, v), f)
Expand Down Expand Up @@ -721,7 +741,7 @@ def gen_print_rsync_assets(self, f):
def gen_print_rsync_iso(self, f):
print(cfg.header, file=f)
self.gen_print_array_no_rsync(f)
if len(self.hdds) > 1 and not self.isos and len(self.flavors) == 1:
if ((len(self.hdds) > 1 and (not self.isos)) or (self.isos and self.hdds)) and len(self.flavors) < 2:
self.gen_print_array_hdd_folder(f)
if self.archs == "armv7hl":
self.p(cfg.rsync_hdds, f, "grep ${arch}", "grep ${arch//armv7hl/armv7l}")
Expand Down Expand Up @@ -905,11 +925,11 @@ def gen_print_openqa(self, f):

i = 0
isos = self.isos.copy()
if len(self.hdds) > 1 and not self.isos and len(self.flavors) == 1:
if ((len(self.hdds) > 1 and not self.isos) or (self.hdds and self.isos)) and len(self.flavors) == 1:
if self.archs == "armv7hl":
self.p(cfg.openqa_call_start_hdds, f, "grep ${arch}", "grep ${arch//armv7hl/armv7l}")
else:
self.p(cfg.openqa_call_start_hdds, f)
self.p(cfg.openqa_call_start_hdds, f, "i=1", "i=" + self.offset)
elif self.hdds or (self.assets and not self.isos):
if self.hdds and self.productpath().startswith("http"):
self.p(' echo " HDD_URL_1=PRODUCTPATH/$destiso \\\\"', f)
Expand Down
2 changes: 2 additions & 0 deletions t/abs/TestIsoHdd-1/files_iso.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test-x86_64-Build1.1.iso
test-x86_64-Build1.1.qcow2
14 changes: 14 additions & 0 deletions t/abs/TestIsoHdd-1/print_openqa.before
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/usr/share/openqa/script/client isos post --host localhost \
ARCH=x86_64 \
ASSET_1155=test-x86_64-Build1.1.iso.sha256 \
ASSET_1156=test-x86_64-Build1.1.qcow2.sha256 \
BUILD=1.1 \
CHECKSUM_HDD_901=$(cut -b-64 /var/lib/openqa/factory/other/test-x86_64-Build1.1.qcow2.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \
CHECKSUM_ISO=$(cut -b-64 /var/lib/openqa/factory/other/test-x86_64-Build1.1.iso.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \
DISTRI=distri \
FLAVOR=TEST \
HDD_901=test-x86_64-Build1.1.qcow2 \
ISO=test-x86_64-Build1.1.iso \
VERSION=1 \
_DEPRIORITIZEBUILD=1

6 changes: 6 additions & 0 deletions t/abs/TestIsoHdd-1/print_rsync_iso.before
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rsync --timeout=3600 -tlp4 --specials obspublish::openqa/TestIsoHdd-1/TestIsoHdd-1:/images/iso/test-x86_64-Build1.1.iso /var/lib/openqa/factory/iso/
rsync --timeout=3600 -tlp4 --specials obspublish::openqa/TestIsoHdd-1/TestIsoHdd-1:/images/iso/test-x86_64-Build1.1.iso.sha256 /var/lib/openqa/factory/other/

rsync --timeout=3600 -tlp4 --specials obspublish::openqa/TestIsoHdd-1/TestIsoHdd-1:/images//test-x86_64-Build1.1.qcow2 /var/lib/openqa/factory/hdd/
rsync --timeout=3600 -tlp4 --specials obspublish::openqa/TestIsoHdd-1/TestIsoHdd-1:/images//test-x86_64-Build1.1.qcow2.sha256 /var/lib/openqa/factory/other/

Empty file.
7 changes: 7 additions & 0 deletions xml/abs/TestIsoHdd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- Example of broject having both iso and hdd -->
<openQA project_pattern="TestIsoHdd-(?P&lt;version&gt;[0-9]+)" dist_path="TestIsoHdd-${version}:/images">
<flavor name="TEST" distri="distri" offset="900">
<iso filemask=".*iso$" folder="iso"/>
<hdd filemask=".*qcow2$"/>
</flavor>
</openQA>