Skip to content

Commit 2a3ce59

Browse files
committed
Include livepatches variables in openqa.cmd
Automate the livepatch isos posts. Due to the logic of the script generation this commit contains an injection of a for loop for all the livepatches which will be found in the spdx.json, after the sync in the server. - the loop always run even if no livepatches found. However it will only append to the isos posts the variable in the case that actually livepatch versions inclue in the array. The approach is just a bit dirty, as any other approach would require further and bigger changes. - The injection is in the `rsync_iso` after all the necessary variables are set and before the beginning writing to the print_openqa.sh. At that point the `spdx.json` should be available and it needs only to grep for the _kernel_livepatch_ in the server. Before that point, the scriptgen.py would have to make a request to each repo in the dist.s.d and it is likely it would be less flexible as the logic of the _isos post_ is mainly in the generated `print_openqa.sh`. depends-on: https://gitlab.suse.de/openqa/openqa-trigger-from-ibs-plugin/-/merge_requests/263 issue: https://progress.opensuse.org/issues/190134 Signed-off-by: Ioannis Bonatakis <[email protected]>
1 parent 5ea66e4 commit 2a3ce59

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

script/cfg.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def pre_openqa_call_start(repos):
309309
openqa_call_start = lambda distri, version, archs, staging, news, news_archs, flavor_distri, meta_variables, assets_flavor, repo0folder, openqa_cli: '''
310310
archs=(ARCHITECTURS)
311311
[ ! -f __envsub/files_repo.lst ] || ! grep -q -- "-POOL-" __envsub/files_repo.lst || additional_repo_suffix=-POOL
312-
312+
declare -a livepatches
313+
livepatches=(NONE)
313314
for flavor in {FLAVORALIASLIST,}; do
314315
for arch in "${archs[@]}"; do
315316
filter=$flavor
@@ -326,6 +327,10 @@ def pre_openqa_call_start(repos):
326327
[ -n "$iso" ] || [ "$flavor" != "''' + assets_flavor + r'''" ] || buildex=$(grep -o -E '(Build|Snapshot)[^-]*' __envsub/files_asset.lst | head -n 1)
327328
[ -n "$iso$build" ] || build=$(grep -h -o -E '(Build|Snapshot)[^-]*' __envsub/Media1*.lst 2>/dev/null | head -n 1 | grep -o -E '[0-9]\.?[0-9]+(\.[0-9]+)*')|| :
328329
[ -n "$build" ] || continue
330+
livepatches=($(grep -oP '(?<=kernel-livepatch-)\d+_\d+_\d+-\d+' "/var/lib/openqa/factory/iso/${iso}" | uniq))
331+
if [ ${#livepatches[@]} -eq 0 ]; then
332+
livepatches=(NONE)
333+
fi
329334
buildex=${buildex/.install.iso/}
330335
buildex=${buildex/.iso/}
331336
buildex=${buildex/.raw.xz/}
@@ -342,7 +347,12 @@ def pre_openqa_call_start(repos):
342347
}
343348
fi
344349
# test "$destiso" != "" || continue
350+
for livepatch in "${livepatches[@]}"; do
345351
echo "''' + openqa_cli + ''' \\\\\"
352+
if [[ "${livepatch}" != "NONE" ]]; then
353+
echo \" KGRAFT=1 \\\\
354+
KERNEL_VERSION=${livepatch} \\\\\"
355+
fi
346356
(
347357
echo \" DISTRI=$distri \\\\
348358
ARCH=$arch \\\\
@@ -583,6 +593,7 @@ def openqa_call_end(version):
583593
echo " FLAVOR=${flavor//Tumbleweed-/} \\\\"
584594
) | LANG=C.UTF-8 sort
585595
echo ""
596+
done
586597
done
587598
done
588599
'''

0 commit comments

Comments
 (0)