Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_changes: support multiple LTS #1424

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions ci-automation/image_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ function _image_changes_impl() {
source sdk_container/.repo/manifests/version.txt
local vernum="${FLATCAR_VERSION}"

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

SUFFIX=
if [ "${channel}" = "lts" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to put SUFFIX= before the if in case the channel is not LTS. Bash will bail out because of unbound variable SUFFIX below.

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 +76,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
Loading