Skip to content

Commit 0fb0e67

Browse files
committed
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 e8ab6a4 commit 0fb0e67

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
@@ -504,39 +504,41 @@ resolve_version_channel() {
504504

505505
case "$normalized" in
506506
n-1)
507-
major_minor_versions=$(echo "$all_tags" | grep -v "\-LTS" |
507+
major_minor_versions=$(echo "$all_tags" | grep -iv -- "-lts" |
508508
awk -F'.' '{ print $1"."$2 }' | sort -u -V)
509509
if [ "$(echo "$major_minor_versions" | wc -l)" -lt 2 ]; then
510510
die "Not enough versions available for N-1. Only $(echo "$major_minor_versions" | wc -l | tr -d ' ') major.minor version(s) found."
511511
fi
512512
target_version=$(echo "$major_minor_versions" | tail -2 | head -1)
513513
;;
514514
n-2)
515-
major_minor_versions=$(echo "$all_tags" | grep -v "\-LTS" |
515+
major_minor_versions=$(echo "$all_tags" | grep -iv -- "-lts" |
516516
awk -F'.' '{ print $1"."$2 }' | sort -u -V)
517517
if [ "$(echo "$major_minor_versions" | wc -l)" -lt 3 ]; then
518518
die "Not enough versions available for N-2. Only $(echo "$major_minor_versions" | wc -l | tr -d ' ') major.minor version(s) found."
519519
fi
520520
target_version=$(echo "$major_minor_versions" | tail -3 | head -1)
521521
;;
522522
lts)
523-
lts_tags=$(echo "$all_tags" | grep "\-LTS")
523+
lts_tags=$(echo "$all_tags" | grep -i -- "-lts")
524524
if [ -z "$lts_tags" ]; then
525525
die "No LTS versions found for sensor type: ${SENSOR_TYPE}"
526526
fi
527527
lts_versions=$(echo "$lts_tags" | awk -F'.' '{ print $1"."$2 }' | sort -u -V)
528-
target_version=$(echo "$lts_versions" | tail -1)
528+
lts_line=$(echo "$lts_versions" | tail -1)
529+
target_version=$(echo "$lts_tags" | grep "^${lts_line}\." | sort -V | tail -1)
529530
;;
530531
lts-1)
531-
lts_tags=$(echo "$all_tags" | grep "\-LTS")
532+
lts_tags=$(echo "$all_tags" | grep -i -- "-lts")
532533
if [ -z "$lts_tags" ]; then
533534
die "No LTS versions found for sensor type: ${SENSOR_TYPE}"
534535
fi
535536
lts_versions=$(echo "$lts_tags" | awk -F'.' '{ print $1"."$2 }' | sort -u -V)
536537
if [ "$(echo "$lts_versions" | wc -l)" -lt 2 ]; then
537538
die "Not enough LTS versions available for LTS-1. Only $(echo "$lts_versions" | wc -l | tr -d ' ') LTS version(s) found."
538539
fi
539-
target_version=$(echo "$lts_versions" | tail -2 | head -1)
540+
lts_line=$(echo "$lts_versions" | tail -2 | head -1)
541+
target_version=$(echo "$lts_tags" | grep "^${lts_line}\." | sort -V | tail -1)
540542
;;
541543
esac
542544

0 commit comments

Comments
 (0)