8 .. include:: ../job-groups.rst
10 Below is a list of Maven job groups:
12 .. literalinclude:: ../../jjb/lf-python-job-groups.yaml
22 Run CLM scanning against a Python project.
26 :clm-project-name: Project name in Nexus IQ to send results to.
31 Install Tox into a virtualenv.
35 :python-version: Version of Python to install into the Tox virtualenv.
41 Runs a shell script that installs tox in a Python virtualenv.
45 :python-version: Base Python version to use in the virtualenv. For example
55 CLM scans for Python based repos. This job will call the Nexus IQ CLI
56 directly to run the scans.
58 A new credential named "nexus-iq-xc-clm" needs to exist in the Jenkins credentials.
59 The credential should contain the username and password to access Nexus
64 - {project-name}-python-clm-{stream}
65 - gerrit-python-xc-clm
66 - github-python-xc-clm
68 :Comment Trigger: run-clm
72 :build-node: The node to run build on.
73 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
74 get configured in defaults.yaml)
78 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
79 :nexus-iq-cli-version: Nexus IQ CLI package version to download and use.
81 :nexus-iq-namespace: Insert a namespace to project AppID for projects that
82 share a Nexus IQ system to avoid project name collision. We recommend
83 inserting a trailing - dash if using this parameter.
84 For example 'odl-'. (default: '')
85 :build-timeout: Timeout in minutes before aborting build. (default: 60)
86 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
87 :java-version: Version of Java to use for the build. (default: openjdk8)
88 :pre-build-script: Shell script to execute before the CLM builder.
89 For example, install prerequisites or move files to the repo root.
90 (default: a string with a shell comment)
91 :stream: Keyword used to represent a release code-name.
92 Often the same as the branch. (default: master)
93 :submodule-recursive: Whether to checkout submodules recursively.
95 :submodule-timeout: Timeout (in minutes) for checkout operation.
97 :submodule-disable: Disable submodule checkout operation.
99 :gerrit_clm_triggers: Override Gerrit Triggers.
100 :gerrit_trigger_file_paths: Override file paths which used to filter which
101 file modifications will trigger a build. Refer to JJB documentation for
103 https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
106 Python Sonar with Tox
107 ---------------------
109 Sonar scans for Python based repos. This job invokes tox to run tests and
110 gather coverage statistics from the test results, then invokes Maven to
111 publish the results to a Sonar server.
113 To get the Sonar coverage results, file tox.ini must exist and contain coverage
116 The coverage commands define the code that gets executed by the test suites.
117 Checking coverage does not guarantee that the tests execute properly, but it
118 identifies code that is not executed by any test.
120 This job reuses the Sonar builder used in Java/Maven projects which runs maven
121 twice. The first invocation does nothing for Python projects, so the job uses
122 the goal 'validate' by default. The second invocation publishes results using
123 the goal 'sonar:sonar' by default.
131 coverage run --module pytest --junitxml xunit-results.xml
132 coverage xml --omit=".tox/py27/*","tests/*"
133 coverage report --omit=".tox/py27/*","tests/*"
135 For more details refer to coverage and sonar documentation:
137 https://coverage.readthedocs.io/
139 https://docs.sonarqube.org/display/PLUG/Python+Coverage+Results+Import
143 - {project-name}-tox-sonar
147 :Comment Trigger: run-sonar
149 :Required parameters:
151 :build-node: The node to run build on.
152 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
153 get configured in defaults.yaml)
154 :mvn-settings: The name of the settings file with credentials for the project.
156 :Optional parameters:
158 :branch: Git branch, should be master (default: master)
159 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
160 :build-timeout: Timeout in minutes before aborting build. (default: 60)
161 :cron: Cron schedule when to trigger the job. This parameter also
162 supports multiline input via YAML pipe | character in cases where
163 one may want to provide more than 1 cron timer. (default: H 11 * * *
165 :disable-job: Whether to disable the job (default: false)
166 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
167 :github-url: URL for Github. (default: https://github.com)
168 :java-version: Version of Java to use for the build. (default: openjdk8)
169 :mvn-global-settings: The name of the Maven global settings to use for
170 :mvn-goals: The Maven goal to run first. (default: validate)
171 :mvn-version: Version of maven to use. (default: mvn35)
172 :pre-build-script: Shell script to execute before the Sonar builder.
173 For example, install prerequisites or move files to the repo root.
174 (default: a string with a comment)
175 :python-version: Python version (default: python2)
176 :sonar-mvn-goal: The Maven goal to run the Sonar plugin. (default: sonar:sonar)
177 :stream: Keyword used to represent a release code-name.
178 Often the same as the branch. (default: master)
179 :submodule-recursive: Whether to checkout submodules recursively.
181 :submodule-timeout: Timeout (in minutes) for checkout operation.
183 :submodule-disable: Disable submodule checkout operation.
185 :gerrit_sonar_triggers: Override Gerrit Triggers.
186 :gerrit_trigger_file_paths: Override file paths which used to filter which
187 file modifications will trigger a build. Refer to JJB documentation for
189 https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
195 Tox runner to verify a project on creation of a patch set.
196 This job is pyenv aware so if the image contains an installation of pyenv
197 at /opt/pyenv it will pick it up and run Python tests with the appropriate
198 Python versions. This job will set the following pyenv variables before running.
202 export PYENV_ROOT="/opt/pyenv"
203 export PATH="$PYENV_ROOT/bin:$PATH"
207 - {project-name}-tox-verify-{stream}
211 :Comment Trigger: recheck|reverify
213 :Required Parameters:
215 :build-node: The node to run build on.
216 :jenkins-ssh-credential: Credential to use for SSH. (Generally set
219 :Optional Parameters:
221 :branch: The branch to build against. (default: master)
222 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
223 :build-timeout: Timeout in minutes before aborting build. (default: 10)
224 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
225 :pre-build-script: Shell script to execute before the Tox builder.
226 For example, install prerequisites or move files to the repo root.
227 (default: a string with a shell comment)
228 :python-version: Version of Python to configure as a base in virtualenv.
230 :stream: Keyword representing a release code-name.
231 Often the same as the branch. (default: master)
232 :submodule-recursive: Whether to checkout submodules recursively.
234 :submodule-timeout: Timeout (in minutes) for checkout operation.
236 :submodule-disable: Disable submodule checkout operation.
238 :tox-dir: Directory containing the project's tox.ini relative to
239 the workspace. Empty works if tox.ini is at project root.
241 :tox-envs: Tox environments to run. If blank run everything described
242 in tox.ini. (default: '')
243 :gerrit_trigger_file_paths: Override file paths used to filter which
244 file modifications will trigger a build. Refer to JJB documentation for
246 https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
252 Tox runner to verify a project after merge of a patch set.
253 This job is pyenv aware so if the image contains an installation of pyenv
254 at /opt/pyenv it will pick it up and run Python tests with the appropriate
255 Python versions. This job will set the following pyenv variables before running.
259 export PYENV_ROOT="/opt/pyenv"
260 export PATH="$PYENV_ROOT/bin:$PATH"
264 - {project-name}-tox-merge-{stream}
268 :Comment Trigger: remerge
270 :Required Parameters:
272 :build-node: The node to run build on.
273 :jenkins-ssh-credential: Credential to use for SSH. (Generally set
276 :Optional Parameters:
278 :branch: The branch to build against. (default: master)
279 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
280 :build-timeout: Timeout in minutes before aborting build. (default: 10)
281 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
282 :pre-build-script: Shell script to execute before the CLM builder.
283 For example, install prerequisites or move files to the repo root.
284 (default: a string with only a comment)
285 :python-version: Version of Python to configure as a base in virtualenv.
287 :stream: Keyword representing a release code-name.
288 Often the same as the branch. (default: master)
289 :submodule-recursive: Whether to checkout submodules recursively.
291 :submodule-timeout: Timeout (in minutes) for checkout operation.
293 :submodule-disable: Disable submodule checkout operation.
295 :tox-dir: Directory containing the project's tox.ini relative to
296 the workspace. Empty works if tox.ini is at project root.
298 :tox-envs: Tox environments to run. If blank run everything described
299 in tox.ini. (default: '')
300 :gerrit_trigger_file_paths: Override file paths used to filter which
301 file modifications will trigger a build. Refer to JJB documentation for
303 https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit