ci-automation/image-changes: Filter out OEM IDs not built for an arch

This is to limit the amount of reports consisting purely of failures,
because some files were missing. And those files will be missing,
because an OEM might not even have any image for certain arches (like
digitalocean has no arm64 images).
This commit is contained in:
Krzesimir Nowak 2023-10-12 12:32:43 +02:00
parent a7853de174
commit d373052ca4
2 changed files with 35 additions and 11 deletions

View File

@ -282,7 +282,7 @@ jobs:
) )
declare -a oemids declare -a oemids
get_oem_id_list . oemids get_oem_id_list . "${arch}" oemids
generate_image_changes_report \ generate_image_changes_report \
"${version_description}" 'image-changes-reports-release.txt' "../flatcar-build-scripts" \ "${version_description}" 'image-changes-reports-release.txt' "../flatcar-build-scripts" \
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \ "${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
@ -339,7 +339,7 @@ jobs:
) )
declare -a oemids declare -a oemids
get_oem_id_list . oemids get_oem_id_list . "${arch}" oemids
generate_image_changes_report \ generate_image_changes_report \
"${version_description}" 'image-changes-reports-nightly.txt' "../flatcar-build-scripts" \ "${version_description}" 'image-changes-reports-nightly.txt' "../flatcar-build-scripts" \
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \ "${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \

View File

@ -108,7 +108,7 @@ function image_changes() (
echo "Image URL: http://${BUILDCACHE_SERVER}/images/${arch}/${version}/flatcar_production_image.bin.bz2" echo "Image URL: http://${BUILDCACHE_SERVER}/images/${arch}/${version}/flatcar_production_image.bin.bz2"
echo echo
local -a oemids local -a oemids
get_oem_id_list . oemids get_oem_id_list . "${arch}" oemids
generate_image_changes_report \ generate_image_changes_report \
"${version_description}" '-' "${fbs_repo}" \ "${version_description}" '-' "${fbs_repo}" \
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \ "${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
@ -201,10 +201,12 @@ function git_tag_for_nightly() {
# Gets a list of OEMs that are using sysexts. # Gets a list of OEMs that are using sysexts.
# #
# 1 - scripts repo # 1 - scripts repo
# 2 - name of an array variable to store the result in # 2 - arch
# 3 - name of an array variable to store the result in
function get_oem_id_list() { function get_oem_id_list() {
local scripts_repo local scripts_repo arch
scripts_repo=${1}; shift scripts_repo=${1}; shift
arch=${1}; shift
local -n list_var_ref=${1}; shift local -n list_var_ref=${1}; shift
local -a ebuilds local -a ebuilds
@ -214,22 +216,44 @@ function get_oem_id_list() {
if [[ ${#ebuilds[@]} -eq 0 ]]; then if [[ ${#ebuilds[@]} -eq 0 ]]; then
return 0 return 0
fi fi
local line mode local mode
# 0 = none OEMIDS line found yet # 0 = no OEMIDS line found yet
# 1 = OEMIDS line found # 1 = OEMIDS line found
mode=0 mode=0
while read -r line; do local -a fields
local first arch_field arch_found
while read -r -a fields; do
if [[ ${#fields[@]} -eq 0 ]]; then
continue
fi
first=${fields[0]}
case ${mode} in case ${mode} in
0) 0)
if [[ ${line} = 'OEMIDS=(' ]]; then if [[ ${first} = 'OEMIDS=(' ]]; then
mode=1 mode=1
fi fi
;; ;;
1) 1)
if [[ ${line} = ')' ]]; then if [[ ${first} = ')' ]]; then
break break
fi fi
list_var_ref+=( "${line}" ) if [[ ${#fields[@]} -gt 1 ]]; then
if [[ ${fields[1]} != '#' ]]; then
echo "expect a line inside OEMIDS to be like '<OEMID> # <ARCH1> <ARCH2>…' or just '<OEMID>', got '${fields[*]}'" >&2
exit 1
fi
arch_found=
for arch_field in "${fields[@]:2}"; do
if [[ ${arch} = "${arch_field}" ]]; then
arch_found=x
break
fi
done
if [[ -z ${arch_found} ]]; then
continue
fi
fi
list_var_ref+=( "${first}" )
;; ;;
esac esac
done <"${ebuilds[0]}" done <"${ebuilds[0]}"