Skip to content

Commit 3b63ca6

Browse files
fix glooctl install: Replace deprecated distutils (#10583)
Co-authored-by: ashish b <[email protected]>
1 parent 376ba90 commit 3b63ca6

File tree

3 files changed

+10
-52
lines changed

3 files changed

+10
-52
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
changelog:
2+
- type: NON_USER_FACING
3+
description: >-
4+
Replace deprecated distutils in the glooctl install script with packaging.version
5+
skipCI-kube-tests:true
6+
skipCI-docs-build:true

projects/gloo/cli/install.sh

+3-26
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,10 @@
22

33
set -eu
44

5-
python_version=
6-
if [ -x "$(command -v python)" ]; then
7-
python_version="$(command -v python)"
8-
echo "Using $python_version"
9-
fi
10-
11-
if [ ! $python_version ]; then
12-
if [ -x "$(command -v python3)" ]; then
13-
python_version="$(command -v python3)"
14-
echo "Using $python_version"
15-
fi
16-
fi
17-
18-
if [ ! $python_version ]; then
19-
if [ -x "$(command -v python2)" ]; then
20-
python_version="$(command -v python2)"
21-
echo "Using $python_version"
22-
fi
23-
fi
24-
25-
if [ ! $python_version ]; then
26-
echo Python is required to install glooctl
27-
exit 1
28-
fi
29-
305
if [ -z "${GLOO_VERSION:-}" ]; then
31-
GLOO_VERSIONS=$(curl -sHL"Accept: application/vnd.github.v3+json" https://api.github.com/repos/solo-io/gloo/releases | $python_version -c "import sys; from distutils.version import StrictVersion, LooseVersion; from json import loads as l; releases = l(sys.stdin.read()); releases = [release['tag_name'] for release in releases]; filtered_releases = list(filter(lambda release_string: len(release_string) > 0 and StrictVersion.version_re.match(release_string[1:]) != None and StrictVersion(release_string[1:]) < StrictVersion('2.0.0') , releases)); filtered_releases.sort(key=LooseVersion, reverse=True); print('\n'.join(filtered_releases))")
6+
# `select(.tag_name | test("-") | not)` should filter out any prerelease versions which contain hyphens (eg. 1.19.0-beta1)
7+
# `select(.tag_name | startswith("v1."))` will filter out any "v2". Though we might be able to get rid of this (see https://github.com/kgateway-dev/kgateway/pull/8856)
8+
GLOO_VERSIONS=$(curl -sHL "Accept: application/vnd.github.v3+json" https://api.github.com/repos/solo-io/gloo/releases | jq -r '[.[] | select(.tag_name | test("-") | not) | select(.tag_name | startswith("v1.")) | .tag_name] | sort_by(.) | reverse | .[0]')
329
else
3310
GLOO_VERSIONS="${GLOO_VERSION}"
3411
fi

projects/gloo/cli/test.sh

+1-26
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,8 @@
22

33
set -eu
44

5-
python_version=
6-
if [ -x "$(command -v python)" ]; then
7-
python_version="$(command -v python)"
8-
echo "Using $python_version"
9-
fi
10-
11-
if [ ! $python_version ]; then
12-
if [ -x "$(command -v python3)" ]; then
13-
python_version="$(command -v python3)"
14-
echo "Using $python_version"
15-
fi
16-
fi
17-
18-
if [ ! $python_version ]; then
19-
if [ -x "$(command -v python2)" ]; then
20-
python_version="$(command -v python2)"
21-
echo "Using $python_version"
22-
fi
23-
fi
24-
25-
if [ ! $python_version ]; then
26-
echo Python is required to install glooctl
27-
exit 1
28-
fi
29-
305
if [ -z "${GLOO_VERSION:-}" ]; then
31-
GLOO_VERSIONS=$(curl -sHL"Accept: application/vnd.github.v3+json" https://api.github.com/repos/solo-io/gloo/releases | $python_version -c "import sys; from distutils.version import StrictVersion, LooseVersion; from json import loads as l; releases = l(sys.stdin.read()); releases = [release['tag_name'] for release in releases]; filtered_releases = list(filter(lambda release_string: len(release_string) > 0 and StrictVersion.version_re.match(release_string[1:]) != None and StrictVersion(release_string[1:]) < StrictVersion('2.0.0') , releases)); filtered_releases.sort(key=LooseVersion, reverse=True); print('\n'.join(filtered_releases))")
6+
GLOO_VERSIONS=$(curl -sHL "Accept: application/vnd.github.v3+json" https://api.github.com/repos/solo-io/gloo/releases | jq -r '[.[] | select(.tag_name | test("-") | not) | select(.tag_name | startswith("v1.")) | .tag_name] | sort_by(.) | reverse | .[0]')
327
else
338
GLOO_VERSIONS="${GLOO_VERSION}"
349
fi

0 commit comments

Comments
 (0)