Document pyenv usage in the tox job
[releng/global-jjb.git] / docs / jjb / lf-python-jobs.rst
1 ###########
2 Python Jobs
3 ###########
4
5 Job Groups
6 ==========
7
8 {project-name}-python-jobs
9 --------------------------
10
11 Jobs for Python projects using Gerrit.
12
13 :Includes:
14
15     - gerrit-tox-verify
16
17 {project-name}-github-python-jobs
18 ---------------------------------
19
20 Jobs for Python projects using GitHub.
21
22 :Includes:
23
24     - github-tox-verify
25
26
27 Macros
28 ======
29
30 lf-tox-install
31 --------------
32
33 Runs a shell script that installs tox in a Python virtualenv.
34
35 :Required Parameters:
36
37     :python-version: Base Python version to use in the virtualenv. For example
38         python2 or python3.
39
40
41 Job Templates
42 =============
43
44 Tox Verify
45 ----------
46
47 Tox runner to verify a project. This job is pyenv aware so if the image
48 contains an installation of pyenv at /opt/pyenv it will pick it up and run
49 Python tests with the appropriate Python versions. This job will set the
50 following pyenv variables before running.
51
52 .. code:: bash
53
54    export PYENV_ROOT="/opt/pyenv"
55    export PATH="$PYENV_ROOT/bin:$PATH"
56
57 :Template Names:
58
59     - {project-name}-tox-verify-{stream}
60     - gerrit-tox-verify
61     - github-tox-verify
62
63 :Required Parameters:
64
65     :build-node: The node to run build on.
66     :jenkins-ssh-credential: Credential to use for SSH. (Generally set
67         in defaults.yaml)
68
69 :Optional Parameters:
70
71     :branch: The branch to build against. (default: master)
72     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
73     :build-timeout: Timeout in seconds before aborting build. (default: 10)
74     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
75     :python-version: Version of Python to configure as a base in virtualenv.
76         (default: python3)
77     :stream: Keyword representing a release code-name.
78         Often the same as the branch. (default: master)
79     :submodule-recursive: Whether to checkout submodules recursively.
80         (default: true)
81     :tox-dir: Directory containing the project's tox.ini relative to
82         the workspace. Empty works if tox.ini is at project root.
83         (default: '')
84     :tox-envs: Tox environments to run. If blank run everything described
85         in tox.ini. (default: '')