From d2ce797d6d7279e257911a963aebfc93aa2d4cd1 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 15 Aug 2024 12:46:01 +0200 Subject: [PATCH 1/2] ci-automation/image-changes: Print changes in extra sysexts --- ci-automation/image_changes.sh | 48 +++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/ci-automation/image_changes.sh b/ci-automation/image_changes.sh index 6af4be47eb1..c6412ab7184 100644 --- a/ci-automation/image_changes.sh +++ b/ci-automation/image_changes.sh @@ -148,15 +148,16 @@ function run_image_changes_job() { # invoke callback that should append necessary info to env and params variables "${cb}" - local -a oemids base_sysexts + local -a oemids base_sysexts extra_sysexts get_oem_id_list . "${arch}" oemids get_base_sysext_list . "${arch}" base_sysexts + get_extra_sysext_list . extra_sysexts generate_image_changes_report \ "${version_description}" "${report_file_name}" "${fbs_repo}" \ "${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \ "${size_changes_env[@]}" --- "${size_changes_params[@]}" -- \ "${show_changes_env[@]}" --- "${show_changes_params[@]}" -- \ - "${oemids[@]}" -- "${base_sysexts[@]}" + "${oemids[@]}" -- "${base_sysexts[@]}" -- "${extra_sysexts[@]}" } # -- @@ -287,6 +288,20 @@ function get_base_sysext_list() { done } +function get_extra_sysext_list() { + local scripts_repo=${1}; shift + local -n list_var_ref=${1}; shift + + # defined in the file we source below + local -a EXTRA_SYSEXTS + source "${scripts_repo}/build_library/extra_sysexts.sh" + + list_var_ref=() + local entry + for entry in "${EXTRA_SYSEXTS[@]}"; do + list_var_ref+=( "${entry%%:*}" ) + done +} # Generates reports with passed parameters. The report is redirected # into the passed report file. @@ -294,7 +309,7 @@ function get_base_sysext_list() { # 1 - version description (a free form string that describes a version of image that current version is compared against) # 2 - report file (can be relative), '-' for standard output # 3 - flatcar-build-scripts directory (can be relative, will be realpathed) -# @ - package-diff env vars --- package-diff version B param -- size-change-report.sh env vars --- size-change-report.sh spec B param -- show-changes env vars --- show-changes param overrides -- list of OEM ids -- list of base sysext names +# @ - package-diff env vars --- package-diff version B param -- size-change-report.sh env vars --- size-change-report.sh spec B param -- show-changes env vars --- show-changes param overrides -- list of OEM ids -- list of base sysext names -- list of extra sysext names # # Example: # @@ -306,7 +321,7 @@ function get_base_sysext_list() { # release:amd64-usr:3456.0.0 bincache:amd64:3478.0.0+my-changes -- \\ # "PATH=${PATH}:${PWD}/ci-automation/python-bin" --- \\ # NEW_VERSION=main-3478.0.0-my-changes NEW_CHANNEL=alpha NEW_CHANNEL_PREV_VERSION=3456.0.0 OLD_CHANNEL=alpha OLD_VERSION='' -- \\ -# azure vmware -- containerd-flatcar docker-flatcar +# azure vmware -- containerd-flatcar docker-flatcar -- python podman zfs function generate_image_changes_report() ( set -euo pipefail @@ -588,7 +603,7 @@ function curl_to_stdout() { # --- -- \\ # --- -- \\ # --- -- \\ -# -- +# -- -- # # Env vars are passed to the called scripts verbatim. Parameters are # described below. @@ -616,7 +631,7 @@ function print_image_reports() { local -a package_diff_env=() package_diff_params=() local -a size_change_report_env=() size_change_report_params=() local -a show_changes_env=() show_changes_params=() - local -a oemids base_sysexts + local -a oemids base_sysexts extra_sysexts local params_shift=0 split_to_env_and_params \ @@ -635,6 +650,8 @@ function print_image_reports() { shift "${params_shift}" get_batch_of_args base_sysexts params_shift "${@}" shift "${params_shift}" + get_batch_of_args extra_sysexts params_shift "${@}" + shift "${params_shift}" flatcar_build_scripts_repo=$(realpath "${flatcar_build_scripts_repo}") @@ -705,6 +722,25 @@ function print_image_reports() { fi done + local extra_sysext + for extra_sysext in "${extra_sysexts[@]}"; do + yell "Extra sysext ${extra_sysext} changes compared to ${previous_version_description}" + underline "Package updates, compared to ${previous_version_description}:" + env \ + "${package_diff_env[@]}" FILE="flatcar-${extra_sysext}_packages.txt" \ + "${flatcar_build_scripts_repo}/package-diff" "${package_diff_params[@]}" 2>&1 + + underline "Image file changes, compared to ${previous_version_description}:" + env \ + "${package_diff_env[@]}" FILE="flatcar-${extra_sysext}_contents.txt" FILESONLY=1 CUTKERNEL=1 \ + "${flatcar_build_scripts_repo}/package-diff" "${package_diff_params[@]}" 2>&1 + + underline "Image file size changes, compared to ${previous_version_description}:" + if ! "${size_changes_invocation[@]}" "${size_change_report_params[@]/%/:extra-sysext-${extra_sysext}-wtd}"; then + "${size_changes_invocation[@]}" "${size_change_report_params[@]/%/:extra-sysext-${extra_sysext}-old}" 2>&1 + fi + done + local oemid for oemid in "${oemids[@]}"; do yell "Sysext changes for OEM ${oemid} compared to ${previous_version_description}" From 248057db13c78a4c4ea703b2635319be1012670d Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 15 Aug 2024 14:45:38 +0200 Subject: [PATCH 2/2] ci-automation/image-changes: Simplify a bit We can strip suffixes using an array notation instead of doing it in a loop. Also drop an unused architecture parameter. --- ci-automation/image_changes.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/ci-automation/image_changes.sh b/ci-automation/image_changes.sh index c6412ab7184..c6a2c34882d 100644 --- a/ci-automation/image_changes.sh +++ b/ci-automation/image_changes.sh @@ -150,7 +150,7 @@ function run_image_changes_job() { local -a oemids base_sysexts extra_sysexts get_oem_id_list . "${arch}" oemids - get_base_sysext_list . "${arch}" base_sysexts + get_base_sysext_list . base_sysexts get_extra_sysext_list . extra_sysexts generate_image_changes_report \ "${version_description}" "${report_file_name}" "${fbs_repo}" \ @@ -276,16 +276,11 @@ function get_oem_id_list() { function get_base_sysext_list() { local scripts_repo=${1}; shift - local arch=${1}; shift local -n list_var_ref=${1}; shift source "${scripts_repo}/ci-automation/base_sysexts.sh" 'local' - list_var_ref=() - local entry - for entry in "${ciabs_base_sysexts[@]}"; do - list_var_ref+=( "${entry%%:*}" ) - done + list_var_ref=( "${ciabs_base_sysexts[@]%%:*}" ) } function get_extra_sysext_list() { @@ -296,11 +291,7 @@ function get_extra_sysext_list() { local -a EXTRA_SYSEXTS source "${scripts_repo}/build_library/extra_sysexts.sh" - list_var_ref=() - local entry - for entry in "${EXTRA_SYSEXTS[@]}"; do - list_var_ref+=( "${entry%%:*}" ) - done + list_var_ref=( "${EXTRA_SYSEXTS[@]%%:*}" ) } # Generates reports with passed parameters. The report is redirected