From 3b12327f7116727b4c19a8465589869a6add032b Mon Sep 17 00:00:00 2001 From: Aric Gardner Date: Mon, 16 Sep 2019 11:32:36 -0400 Subject: [PATCH] pyenv pick latest installed version Logic to pick latest version of pyev. Builders may have diffrent versions installed. Signed-off-by: Aric Gardner Change-Id: I2eb5cc75d815778bb35f166d1512711705b6ccd7 --- releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml | 7 +++++++ shell/check-info-votes.sh | 9 ++++++++- shell/release-job.sh | 12 ++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml diff --git a/releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml b/releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml new file mode 100644 index 00000000..7d6bb561 --- /dev/null +++ b/releasenotes/notes/pyenv-6d86242e2a8be6eb.yaml @@ -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. diff --git a/shell/check-info-votes.sh b/shell/check-info-votes.sh index 51ca172f..32384be4 100644 --- a/shell/check-info-votes.sh +++ b/shell/check-info-votes.sh @@ -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 diff --git a/shell/release-job.sh b/shell/release-job.sh index 2ac368f6..c27a87f8 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -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. -- 2.16.6