Use configured python version to install tox-pyenv 63/61663/4
authorLott, Christopher (cl778h) <cl778h@att.com>
Mon, 9 Sep 2019 15:08:37 +0000 (11:08 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Tue, 10 Sep 2019 17:45:24 +0000 (13:45 -0400)
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) <cl778h@att.com>
Issue: RELENG-2361

docs/jjb/lf-macros.rst
docs/jjb/lf-rtd-jobs.rst
jjb/lf-macros.yaml
jjb/lf-python-jobs.yaml
jjb/lf-rtd-jobs.yaml
releasenotes/notes/tox-install-use-python-version-486621184e7aa090.yaml [new file with mode: 0644]
shell/tox-install.sh

index 1b1b976..a653bc5 100644 (file)
@@ -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
 ----------------
index c983b58..393d091 100644 (file)
@@ -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.
index 15f008a..91fd16b 100644 (file)
     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
 
index 0fdb2a2..ffdc381 100644 (file)
@@ -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:
index bb78d2c..60f89d3 100644 (file)
     git-url: "$GIT_URL/$PROJECT"
     github-url: "https://github.com"
     project-pattern: "**"
+    python-version: python2
     stream: master
     submodule-recursive: true
     submodule-timeout: 10
       - 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 (file)
index 0000000..ecfbe33
--- /dev/null
@@ -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.
index 4708e88..25ff3ca 100644 (file)
 ##############################################################################
 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