X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fcheck-info-votes.sh;h=69d0b4845141d1d0194f295bc74a72d28f623696;hb=04547fcca5cabd3d9ad24fced4a0cf268d789296;hp=72dec3b8f07157c57e78d17dcfc977d7d613d06c;hpb=99d9f864cb6b47631503472f064693fc7f68ec8e;p=releng%2Fglobal-jjb.git diff --git a/shell/check-info-votes.sh b/shell/check-info-votes.sh index 72dec3b8..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 @@ -34,16 +41,20 @@ $pip install --user lftools $pip install --user lftools[nexus] $pip install --user jsonschema -change="$(echo "$GERRIT_CHANGE_URL" | awk -F"/" '{print $NF}')" 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 "$change" --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