Skip to content

Commit b1ebeb0

Browse files
committed
test extract versions
1 parent 0e4a5c3 commit b1ebeb0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/cd.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ jobs:
3636
id: kubectl_versions
3737
run: |
3838
python --version
39-
skopeo list-tags docker://registry.k8s.io/kubectl | jq -r '.Tags | .[]| select(. | match("v[0-9].[0-9]{2}.[0-9]$"))'
39+
export ALL_VERSIONS=$(skopeo list-tags docker://registry.k8s.io/kubectl | jq -r '.Tags | .[]| select(. | match("v[0-9].[0-9]{2}.[0-9]$"))')
40+
VERSIONS=$(python ./get_kubectl_versions.py)
41+
echo ${VERSIONS}
4042
echo "kubectl_versions=${VERSIONS} >> $GITHUB_OUTPUT
4143
4244

get_kubectl_versions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/python3
2+
import os
3+
import json
4+
MIN_VERSION = 1.32
5+
versions = os.getenv('VERSIONS').split('\n')
6+
ret = {}
7+
for v in versions:
8+
vsplit = v.split('.')
9+
short_version = float(".".join([vsplit[0],vsplit[1]]).lstrip("v"))
10+
if short_version >= MIN_VERSION:
11+
ret[vsplit[1]] = v
12+
print(json.dumps(ret))

0 commit comments

Comments
 (0)