X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcheck-info-votes.sh;h=69d0b4845141d1d0194f295bc74a72d28f623696;hb=04547fcca5cabd3d9ad24fced4a0cf268d789296;hp=1e02a386edfe4c026244cac700f76c83a58844b2;hpb=12853a424496b5d87c355f32fa27604099a0edbb;p=releng%2Fglobal-jjb.git diff --git a/shell/check-info-votes.sh b/shell/check-info-votes.sh index 1e02a386..69d0b484 100644 --- a/shell/check-info-votes.sh +++ b/shell/check-info-votes.sh @@ -16,17 +16,24 @@ pip="pip3" # For OPNFV if [[ $NODE_NAME =~ "lf-build" ]]; then - pip=pip + pip=pip fi if [ -d "/opt/pyenv" ]; then - echo "---> Setting up pyenv" - export PYENV_ROOT="/opt/pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - PYTHONPATH=$(pwd) - export PYTHONPATH - pyenv local 3.6.4 - export PYENV_VERSION="3.6.4" + echo "---> Setting up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + PYTHONPATH=$(pwd) + export PYTHONPATH + + 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 $pip install --user niet @@ -35,16 +42,19 @@ $pip install --user lftools[nexus] $pip install --user jsonschema echo "Checking votes:" -lftools infofile check-votes INFO.yaml "$GERRIT_URL" "$ref" > gerrit_comment.txt +lftools infofile check-votes INFO.yaml "$GERRIT_URL" \ + "$ref" > gerrit_comment.txt exit_status="$?" if [[ "$exit_status" -ne 0 ]]; then - echo "Vote not yet complete" - cat gerrit_comment.txt - exit "$exit_status" + echo "Vote not yet complete" + cat gerrit_comment.txt + exit "$exit_status" else - echo "Vote completed submitting review" - ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review "$GERRIT_PATCHSET_REVISION" --verified 1 - sleep 5 - ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review "$GERRIT_PATCHSET_REVISION" --submit + echo "Vote completed submitting review" + ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review \ + "$GERRIT_PATCHSET_REVISION" --verified 1 + sleep 5 + ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review \ + "$GERRIT_PATCHSET_REVISION" --submit fi