Skip to content

Commit b2444e4

Browse files
authored
Prefer final chart over RC when computing latest release version (#4866)
* Prefer final chart over RC when computing latest release version
1 parent d90df2a commit b2444e4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/scripts/compute-rancher-versions.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ chart_response=$(curl -fsSL \
4141
exit 1
4242
}
4343

44-
latest_chart=$(printf '%s' "$chart_response" \
45-
| jq -r '.[] | select(.type == "dir") | .name' \
46-
| sort -V | tail -1)
44+
# Prefer a final (non-pre-release) chart over an RC: sort -V ranks "0.14.4-rc.5"
45+
# above "0.14.4" because the RC has extra characters, so without filtering the
46+
# RC would be selected even after the final chart has been published.
47+
all_charts=$(printf '%s' "$chart_response" \
48+
| jq -r '.[] | select(.type == "dir") | .name')
49+
latest_chart=$(printf '%s' "$all_charts" | { grep -v '+up.*-' || true; } | sort -V | tail -1)
50+
if [ -z "$latest_chart" ]; then
51+
latest_chart=$(printf '%s' "$all_charts" | sort -V | tail -1)
52+
fi
4753

4854
if [ -z "$latest_chart" ]; then
4955
printf 'ERROR: No Fleet chart directories found in rancher/charts branch %s\n' "$charts_branch" >&2

0 commit comments

Comments
 (0)