Skip to content

Commit 15046b9

Browse files
fix(ci): handle major versions in compatibility table generator (cherry-pick #22370) (#22371)
Signed-off-by: Michael Crenshaw <[email protected]> Co-authored-by: Michael Crenshaw <[email protected]>
1 parent 8545d21 commit 15046b9

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

hack/update-supported-versions.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ argocd_minor_version=$(git rev-parse --abbrev-ref HEAD | sed 's/release-//')
77
argocd_major_version_num=$(echo "$argocd_minor_version" | sed -E 's/\.[0-9]+//')
88
argocd_minor_version_num=$(echo "$argocd_minor_version" | sed -E 's/[0-9]+\.//')
99

10-
for n in 0 1 2; do
11-
minor_version_num=$((argocd_minor_version_num - n))
10+
minor_version_decrement=0
11+
for _ in {1..3}; do
12+
minor_version_num=$((argocd_minor_version_num - minor_version_decrement))
1213
minor_version="${argocd_major_version_num}.${minor_version_num}"
1314
git checkout "release-$minor_version" > /dev/null || exit 1
1415

@@ -19,9 +20,22 @@ for n in 0 1 2; do
1920
jq --arg minor_version "$minor_version" --raw-input --slurp --raw-output \
2021
'split("\n")[:-1] | map(sub("\\.[0-9]+$"; "")) | join(", ") | "| \($minor_version) | \(.) |"')
2122
out+="$line\n"
23+
24+
minor_version_decrement=$((minor_version_decrement + 1))
25+
26+
# If we're at minor version 0, there's no further version back in this series. Instead, move to the latest version in
27+
# the previous major release series.
28+
if [ "$argocd_minor_version_num" -eq 0 ]; then
29+
argocd_major_version_num=$((argocd_major_version_num - 1))
30+
# Get the latest minor version in the previous series.
31+
argocd_minor_version_num=$(git branch -l "release-$argocd_major_version_num.*" | sort -V | tail -n 1 | sed -E 's/release-[0-9]+\.//')
32+
33+
# Don't decrement the minor version, since we're switching to the previous major release series. We want the latest
34+
# minor version in that series.
35+
minor_version_decrement=0
36+
fi
2237
done
2338

2439
git checkout "release-$argocd_minor_version"
2540

26-
2741
printf "$out" > docs/operator-manual/tested-kubernetes-versions.md

0 commit comments

Comments
 (0)