From 12eace1d1f832e2c42147ac7826c87670ec0cc0c Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Mon, 9 Sep 2019 11:08:37 -0400 Subject: [PATCH] Use configured python version to install tox-pyenv Revise the tox-install.sh script to use PYTHON env var to invoke pip, instead of hardcoded 'python'. Add python-version parameter to Read-The-Docs doc, macro and templates. Change-Id: Ib0fe98dca62ce67f0ad002036b54f02faf27e888 Signed-off-by: Lott, Christopher (cl778h) Issue: RELENG-2361 --- docs/jjb/lf-macros.rst | 7 ++++++- docs/jjb/lf-rtd-jobs.rst | 3 ++- jjb/lf-macros.yaml | 4 +++- jjb/lf-python-jobs.yaml | 2 +- jjb/lf-rtd-jobs.yaml | 2 ++ .../tox-install-use-python-version-486621184e7aa090.yaml | 6 ++++++ shell/tox-install.sh | 11 +++++------ 7 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/tox-install-use-python-version-486621184e7aa090.yaml diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 1b1b9765..a653bc55 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -240,7 +240,12 @@ Script to trigger a build on http://readthedocs.org lf-rtd-verify ------------- -ReadTheDocs verify script. +ReadTheDocs verify script. Installs and runs tox. + +:Required parameters: + + :doc-dir: Document directory. + :python-version: Python version. check-info-votes ---------------- diff --git a/docs/jjb/lf-rtd-jobs.rst b/docs/jjb/lf-rtd-jobs.rst index c983b58c..393d0917 100644 --- a/docs/jjb/lf-rtd-jobs.rst +++ b/docs/jjb/lf-rtd-jobs.rst @@ -99,7 +99,7 @@ ReadTheDocs. To do that follow these steps: ReadTheDocs Verify ------------------ -Verify job which runs a tox build of the docs project +Verify job which runs tox to test the docs project :Template Names: - {project-name}-rtd-verify-{stream} @@ -125,6 +125,7 @@ Verify job which runs a tox build of the docs project :gerrit-skip-vote: Skip voting for this job. (default: false) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :project-pattern: Project to trigger build against. (default: \*\*) + :python-version: Python version (default: python2) :stream: Keyword representing a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index 15f008a5..91fd16b5 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -260,7 +260,9 @@ name: lf-rtd-verify builders: - inject: - properties-content: DOC_DIR={doc-dir} + properties-content: | + DOC_DIR={doc-dir} + PYTHON={python-version} - shell: !include-raw-escape: ../shell/tox-install.sh - shell: !include-raw-escape: ../shell/rtd-verify.sh diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index 0fdb2a2d..ffdc381b 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -7,7 +7,7 @@ name: lf-infra-tox-install builders: - inject: - properties-content: "PYTHON_VERSION={python-version}" + properties-content: "PYTHON={python-version}" - shell: !include-raw-escape: ../shell/tox-install.sh - builder: diff --git a/jjb/lf-rtd-jobs.yaml b/jjb/lf-rtd-jobs.yaml index bb78d2c5..60f89d3a 100644 --- a/jjb/lf-rtd-jobs.yaml +++ b/jjb/lf-rtd-jobs.yaml @@ -164,6 +164,7 @@ git-url: "$GIT_URL/$PROJECT" github-url: "https://github.com" project-pattern: "**" + python-version: python2 stream: master submodule-recursive: true submodule-timeout: 10 @@ -189,6 +190,7 @@ - lf-infra-pre-build - lf-rtd-verify: doc-dir: "{doc-dir}" + python-version: "{python-version}" - job-template: name: "{project-name}-rtd-verify-{stream}" diff --git a/releasenotes/notes/tox-install-use-python-version-486621184e7aa090.yaml b/releasenotes/notes/tox-install-use-python-version-486621184e7aa090.yaml new file mode 100644 index 00000000..ecfbe33c --- /dev/null +++ b/releasenotes/notes/tox-install-use-python-version-486621184e7aa090.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Revise tox-install.sh script to invoke python using environment variable + PYTHON instead of hardcoding "python", and remove the pip --quiet flag. + Extend the RTD template to pass python-version, default python2. diff --git a/shell/tox-install.sh b/shell/tox-install.sh index 4708e88c..25ff3ca5 100644 --- a/shell/tox-install.sh +++ b/shell/tox-install.sh @@ -10,12 +10,11 @@ ############################################################################## echo "---> tox-install.sh" -# Ensure we fail the job if any steps fail. -# DO NOT set -u as virtualenv's activate script has unbound variables -set -e -o pipefail +# Ensure we fail the job if any steps fail or variables are missing. +# Use -x to show value of $PYTHON in output +set -eux -o pipefail # Tox version is pulled in through detox to mitigate version conflict -python -m pip install --user --quiet --upgrade tox-pyenv +$PYTHON -m pip install --user --quiet --upgrade tox-pyenv -echo "----> pip freeze" -pip freeze +$PYTHON -m pip freeze -- 2.16.6