Skip to content

Commit

Permalink
image_changes: support multiple LTS
Browse files Browse the repository at this point in the history
When we support two LTS, the oldest one is compare to the newer one (e.g
lts-2022 is compared to lts-2023).

We now read the 'lts-info' file to find the right version to compare
(e.g lts-2022 is compared to the 'current-2022')

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
  • Loading branch information
tormath1 committed Nov 27, 2023
1 parent 8bc09a4 commit 4390fc6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ci-automation/image_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ function _image_changes_impl() {
source sdk_container/.repo/manifests/version.txt
local vernum="${FLATCAR_VERSION}"

MAJOR_B=$(echo "${FLATCAR_VERSION}" | cut -d . -f 1)

if [ "${channel}" = "lts" ]; then
curl -fsSLO --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 'https://lts.release.flatcar-linux.net/lts-info'
while read -r LINE; do
# each line is major:year:(supported|unsupported)
TUPLE=(${LINE//:/ })
MAJOR="${TUPLE[0]}"
if [[ "${MAJOR_B}" = "${MAJOR}" ]]; then
SUFFIX="-${TUPLE[1]}"
break
fi
done <lts-info
rm -f lts-info
fi

echo "==================================================================="
export BOARD_A="${arch}-usr"
export FROM_A="release"
Expand All @@ -59,9 +75,8 @@ function _image_changes_impl() {
else
NEW_CHANNEL="${channel}"
fi
NEW_CHANNEL_VERSION_A=$(curl -fsSL --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 "https://${NEW_CHANNEL}.release.flatcar-linux.net/${BOARD_A}/current/version.txt" | grep -m 1 FLATCAR_VERSION= | cut -d = -f 2)
NEW_CHANNEL_VERSION_A=$(curl -fsSL --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 "https://${NEW_CHANNEL}.release.flatcar-linux.net/${BOARD_A}/current${SUFFIX}/version.txt" | grep -m 1 FLATCAR_VERSION= | cut -d = -f 2)
MAJOR_A=$(echo "${NEW_CHANNEL_VERSION_A}" | cut -d . -f 1)
MAJOR_B=$(echo "${FLATCAR_VERSION}" | cut -d . -f 1)
# When the major version for the new channel is different, a transition has happened and we can find the previous release in the old channel
if [ "${MAJOR_A}" != "${MAJOR_B}" ]; then
case "${NEW_CHANNEL}" in
Expand Down

0 comments on commit 4390fc6

Please sign in to comment.