Skip to content

Commit

Permalink
Fix latest stable version number retrieval (linkerd#1063)
Browse files Browse the repository at this point in the history
Followup to linkerd#1060

The problem with the previous way was that we just picked the latest (by
date) version published in Github, which doesn't work when we publish a
minor version for an older major version. E.g. the latest (by version)
stable being 2.10.1, then we publish 2.9.5, then this algorithm will
wrongly pick 2.9.5 as the latest stable.

In this fix we get the list of stable versions from github, sort using
`sort -V` and pick the latest item.

Co-authored-by: cpretzer <[email protected]>
  • Loading branch information
alpeb and cpretzer authored Apr 30, 2021
1 parent 1ae3d88 commit 97240dd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bin/export-channel-versions
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ releases_url="https://api.github.com/repos/linkerd/linkerd2/releases"
stable_tag_regex="\"tag_name\": \"stable-[0-9]+\.[0-9]+\.[0-9]\""
edge_tag_regex="\"tag_name\": \"edge-[0-9]+\.[0-9]+\.[0-9]\""

#export L5D2_STABLE_VERSION=$(curl -s $releases_url | awk -v pattern="$stable_tag_regex" '$0 ~ pattern {gsub(/"/, "", $2); gsub(/,$/,""); print $2; exit}')
export L5D2_STABLE_VERSION=stable-2.10.1
export L5D2_STABLE_VERSION=$(curl -s $releases_url | awk -v pattern="$stable_tag_regex" '$0 ~ pattern {gsub(/"/, "", $2); gsub(/,$/,""); print $2}' | sort -V | tail -n 1)
export L5D2_EDGE_VERSION=$(curl -s $releases_url | awk -v pattern="$edge_tag_regex" '$0 ~ pattern {gsub(/"/, "", $2); gsub(/,$/,""); print $2; exit}')

0 comments on commit 97240dd

Please sign in to comment.