Skip to content

Commit

Permalink
ci-automation/image-changes: Filter out OEM IDs not built for an arch
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
krnowak committed Oct 12, 2023
1 parent 22cda9d commit 74f1d17
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ jobs:
)
declare -a oemids
get_oem_id_list . oemids
get_oem_id_list . "${arch}" oemids
generate_image_changes_report \
"${version_description}" 'image-changes-reports-release.txt' "../flatcar-build-scripts" \
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
Expand Down Expand Up @@ -352,7 +352,7 @@ jobs:
)
declare -a oemids
get_oem_id_list . oemids
get_oem_id_list . "${arch}" oemids
generate_image_changes_report \
"${version_description}" 'image-changes-reports-nightly.txt' "../flatcar-build-scripts" \
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
Expand Down
40 changes: 32 additions & 8 deletions ci-automation/image_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,12 @@ function git_tag_for_nightly() {
# Gets a list of OEMs that are using sysexts.
#
# 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() {
local scripts_repo
local scripts_repo arch
scripts_repo=${1}; shift
arch=${1}; shift
local -n list_var_ref=${1}; shift

local -a ebuilds
Expand All @@ -214,22 +216,44 @@ function get_oem_id_list() {
if [[ ${#ebuilds[@]} -eq 0 ]]; then
return 0
fi
local line mode
# 0 = none OEMIDS line found yet
local mode
# 0 = no OEMIDS line found yet
# 1 = OEMIDS line found
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
0)
if [[ ${line} = 'OEMIDS=(' ]]; then
if [[ ${first} = 'OEMIDS=(' ]]; then
mode=1
fi
;;
1)
if [[ ${line} = ')' ]]; then
if [[ ${first} = ')' ]]; then
break
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
done <"${ebuilds[0]}"
Expand Down

0 comments on commit 74f1d17

Please sign in to comment.