pyenv pick latest installed version 39/61739/4
authorAric Gardner <agardner@linuxfoundation.org>
Mon, 16 Sep 2019 15:32:36 +0000 (11:32 -0400)
committerAric Gardner <agardner@linuxfoundation.org>
Mon, 16 Sep 2019 16:45:40 +0000 (12:45 -0400)
Logic to pick latest version of pyev.
Builders may have diffrent versions installed.

Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
Change-Id: I2eb5cc75d815778bb35f166d1512711705b6ccd7

releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml [new file with mode: 0644]
shell/check-info-votes.sh
shell/release-job.sh

diff --git a/releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml b/releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml
new file mode 100644 (file)
index 0000000..7d6bb56
--- /dev/null
@@ -0,0 +1,7 @@
+---
+fix:
+  - |
+    Builders may have diffrent pyenv versions installed.
+    Programically pick the latest pyenv version.
+    Since we change pyenv version when building images, we do not know which
+    pyenv version are avaliable.
index 51ca172..32384be 100644 (file)
@@ -25,7 +25,14 @@ if [ -d "/opt/pyenv" ]; then
     export PATH="$PYENV_ROOT/bin:$PATH"
     PYTHONPATH=$(pwd)
     export PYTHONPATH
-    pyenv local 3.6.4
+
+    latest_version=$(pyenv versions \
+      | sed s,*,,g \
+      | awk '/[0-9]+/{ print $1 }' \
+      | sort --version-sort \
+      | awk '/./{line=$0} END{print line}')
+
+    pyenv local "$latest_version"
     export PYENV_VERSION="3.6.4"
 fi
 
index 2ac368f..c27a87f 100644 (file)
@@ -19,8 +19,16 @@ if [ -d "/opt/pyenv" ]; then
 fi
 PYTHONPATH=$(pwd)
 export PYTHONPATH
-pyenv local 3.6.4
-export PYENV_VERSION="3.6.4"
+
+latest_version=$(pyenv versions \
+  | sed s,*,,g \
+  | awk '/[0-9]+/{ print $1 }' \
+  | sort --version-sort \
+  | awk '/./{line=$0} END{print line}')
+
+pyenv local "$latest_version"
+
+export PYENV_VERSION="$latest_version"
 pip install --user lftools[nexus] jsonschema niet yq
 
 #Functions.