From 74f1d176fab9bf17017443bfdf59678607bf4682 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 12 Oct 2023 12:32:43 +0200 Subject: [PATCH] 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). --- .github/workflows/ci.yaml | 4 ++-- ci-automation/image_changes.sh | 40 +++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dd177de1da9..0adf33deced 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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[@]}" -- \ @@ -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[@]}" -- \ diff --git a/ci-automation/image_changes.sh b/ci-automation/image_changes.sh index 7734d5b361f..1cd565f3382 100644 --- a/ci-automation/image_changes.sh +++ b/ci-automation/image_changes.sh @@ -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 @@ -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 ' # …' or just '', 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]}"