Skip to content

Commit 6dbf203

Browse files
fix(container-pull): fix LTS case sensitivity and return LTS-tagged image
The registry uses lowercase "-lts" suffix on LTS tags (e.g. 7.32.0-18504-1-lts), but the version channel resolver was grepping for uppercase "-LTS", causing LTS/LTS-1 to always die with "No LTS versions found" and the N-1/N-2 exclusion to silently leak LTS tags into the candidate list. Also changes LTS/LTS-1 resolution to return the full "-lts" tagged image directly rather than extracting the major.minor prefix, which previously caused match_sensor_version to select the latest non-LTS build of that line instead of the designated LTS build.
1 parent b5f2c65 commit 6dbf203

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

bash/containers/falcon-container-sensor-pull/falcon-container-sensor-pull.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,39 +503,41 @@ resolve_version_channel() {
503503

504504
case "$normalized" in
505505
n-1)
506-
major_minor_versions=$(echo "$all_tags" | grep -v "\-LTS" |
506+
major_minor_versions=$(echo "$all_tags" | grep -iv -- "-lts" |
507507
awk -F'.' '{ print $1"."$2 }' | sort -u -V)
508508
if [ "$(echo "$major_minor_versions" | wc -l)" -lt 2 ]; then
509509
die "Not enough versions available for N-1. Only $(echo "$major_minor_versions" | wc -l | tr -d ' ') major.minor version(s) found."
510510
fi
511511
target_version=$(echo "$major_minor_versions" | tail -2 | head -1)
512512
;;
513513
n-2)
514-
major_minor_versions=$(echo "$all_tags" | grep -v "\-LTS" |
514+
major_minor_versions=$(echo "$all_tags" | grep -iv -- "-lts" |
515515
awk -F'.' '{ print $1"."$2 }' | sort -u -V)
516516
if [ "$(echo "$major_minor_versions" | wc -l)" -lt 3 ]; then
517517
die "Not enough versions available for N-2. Only $(echo "$major_minor_versions" | wc -l | tr -d ' ') major.minor version(s) found."
518518
fi
519519
target_version=$(echo "$major_minor_versions" | tail -3 | head -1)
520520
;;
521521
lts)
522-
lts_tags=$(echo "$all_tags" | grep "\-LTS")
522+
lts_tags=$(echo "$all_tags" | grep -i -- "-lts")
523523
if [ -z "$lts_tags" ]; then
524524
die "No LTS versions found for sensor type: ${SENSOR_TYPE}"
525525
fi
526526
lts_versions=$(echo "$lts_tags" | awk -F'.' '{ print $1"."$2 }' | sort -u -V)
527-
target_version=$(echo "$lts_versions" | tail -1)
527+
lts_line=$(echo "$lts_versions" | tail -1)
528+
target_version=$(echo "$lts_tags" | grep "^${lts_line}\." | sort -V | tail -1)
528529
;;
529530
lts-1)
530-
lts_tags=$(echo "$all_tags" | grep "\-LTS")
531+
lts_tags=$(echo "$all_tags" | grep -i -- "-lts")
531532
if [ -z "$lts_tags" ]; then
532533
die "No LTS versions found for sensor type: ${SENSOR_TYPE}"
533534
fi
534535
lts_versions=$(echo "$lts_tags" | awk -F'.' '{ print $1"."$2 }' | sort -u -V)
535536
if [ "$(echo "$lts_versions" | wc -l)" -lt 2 ]; then
536537
die "Not enough LTS versions available for LTS-1. Only $(echo "$lts_versions" | wc -l | tr -d ' ') LTS version(s) found."
537538
fi
538-
target_version=$(echo "$lts_versions" | tail -2 | head -1)
539+
lts_line=$(echo "$lts_versions" | tail -2 | head -1)
540+
target_version=$(echo "$lts_tags" | grep "^${lts_line}\." | sort -V | tail -1)
539541
;;
540542
esac
541543

0 commit comments

Comments
 (0)