Fix API breakage caused by OS Plugin version scan
[releng/global-jjb.git] / jjb / lf-python-jobs.yaml
1 ---
2 - job-group:
3     name: '{project-name}-python-jobs'
4
5     # This job group contains all the recommended jobs that should be deployed
6     # for any project ci that is using Gerrit.
7
8     jobs:
9       - gerrit-python-xc-clm
10       - gerrit-tox-verify
11
12 - job-group:
13     name: '{project-name}-github-python-jobs'
14
15     # This job group contains all the recommended jobs that should be deployed
16     # for any project ci that is using GitHub.
17
18     jobs:
19       - github-python-xc-clm
20       - github-tox-verify
21
22 ##########
23 # Macros #
24 ##########
25
26 - builder:
27     name: lf-infra-tox-install
28     builders:
29       - inject:
30           properties-content: 'PYTHON_VERSION={python-version}'
31       - shell: !include-raw-escape: ../shell/tox-install.sh
32
33 - builder:
34     name: lf-infra-clm-python
35     builders:
36       - inject:
37           properties-content: 'CLM_PROJECT_NAME={clm-project-name}'
38       - shell: !include-raw-escape:
39           - ../shell/nexus-iq-cli.sh
40
41 ####################
42 # COMMON FUNCTIONS #
43 ####################
44
45 - lf_python_common: &lf_python_common
46     name: lf-python-common
47
48     ######################
49     # Default parameters #
50     ######################
51
52     archive-artifacts: >
53       **/*.log
54
55     #####################
56     # Job Configuration #
57     #####################
58
59     project-type: freestyle
60     node: '{build-node}'
61
62     properties:
63       - lf-infra-properties:
64           build-days-to-keep: '{build-days-to-keep}'
65
66     parameters:
67       - lf-infra-parameters:
68           project: '{project}'
69           branch: '{branch}'
70           stream: '{stream}'
71           lftools-version: '{lftools-version}'
72
73     wrappers:
74       - lf-infra-wrappers:
75           build-timeout: '{build-timeout}'
76           jenkins-ssh-credential: '{jenkins-ssh-credential}'
77
78     publishers:
79       - lf-infra-publish
80
81 #################
82 # Python XC CLM #
83 #################
84
85 - lf_python_clm_xc: &lf_python_xc_clm
86     name: lf-python-xc-clm
87
88     ######################
89     # Default parameters #
90     ######################
91
92     branch: master
93     build-days-to-keep: 30  # 30 days for troubleshooting purposes
94     build-timeout: 60
95     git-url: '$GIT_URL/$PROJECT'
96     java-version: openjdk8
97     nexus-iq-cli-version: 1.44.0-01
98     staging-profile-id: ''  # Unused in this job
99     stream: master
100     submodule-recursive: true
101
102     gerrit_trigger_file_paths:
103       - compare-type: ANT
104         pattern: '.*'
105
106     # github_included_regions MUST match gerrit_trigger_file_paths
107     github_included_regions:
108       - '.*'
109
110     #####################
111     # Job Configuration #
112     #####################
113
114     parameters:
115       - lf-infra-parameters:
116           project: '{project}'
117           branch: '{branch}'
118           stream: '{stream}'
119           lftools-version: '{lftools-version}'
120       - string:
121           name: NEXUS_IQ_CLI_VERSION
122           default: '{nexus-iq-cli-version}'
123           description: Nexus IQ CLI package to download and use.
124
125     wrappers:
126       - credentials-binding:
127           - username-password-separated:
128               credential-id: nexus-iq-xc-clm
129               username: CLM_USER
130               password: CLM_PASSWORD
131     builders:
132       - lf-update-java-alternatives:
133           java-version: '{java-version}'
134       - lf-infra-clm-python:
135           clm-project-name: '{project-name}'
136
137 - job-template:
138     name: '{project-name}-python-clm-{stream}'
139     id: gerrit-python-xc-clm
140     <<: *lf_python_common
141     # yamllint disable-line rule:key-duplicates
142     <<: *lf_python_xc_clm
143
144     ######################
145     # Default parameters #
146     ######################
147
148     gerrit_clm_triggers:
149       - comment-added-contains-event:
150           comment-contains-value: run-clm$
151
152     #####################
153     # Job Configuration #
154     #####################
155
156     scm:
157       - lf-infra-gerrit-scm:
158           jenkins-ssh-credential: '{jenkins-ssh-credential}'
159           git-url: '{git-url}'
160           refspec: '$GERRIT_REFSPEC'
161           branch: '$GERRIT_BRANCH'
162           submodule-recursive: '{submodule-recursive}'
163           choosing-strategy: default
164
165     triggers:
166       # Build weekly on Saturdays
167       - timed: 'H H * * 6'
168       - gerrit:
169           server-name: '{gerrit-server-name}'
170           trigger-on: '{obj:gerrit_clm_triggers}'
171           projects:
172             - project-compare-type: ANT
173               project-pattern: '{project}'
174               branches:
175                 - branch-compare-type: ANT
176                   branch-pattern: '**/{branch}'
177               file-paths: '{obj:gerrit_trigger_file_paths}'
178           skip-vote:
179             successful: true
180             failed: true
181             unstable: true
182             notbuilt: true
183
184 - job-template:
185     name: '{project-name}-python-clm-{stream}'
186     id: github-python-xc-clm
187     <<: *lf_python_common
188     # yamllint disable-line rule:key-duplicates
189     <<: *lf_python_xc_clm
190
191     properties:
192       - github:
193           url: '{git-url}/{github-org}/{project}'
194
195     scm:
196       - lf-infra-github-scm:
197           url: '{git-clone-url}{github-org}/{project}'
198           refspec: ''
199           branch: 'refs/heads/{branch}'
200           submodule-recursive: '{submodule-recursive}'
201           choosing-strategy: default
202           jenkins-ssh-credential: '{jenkins-ssh-credential}'
203
204     triggers:
205       # Build weekly on Saturdays
206       - timed: 'H H * * 6'
207       - github-pull-request:
208           trigger-phrase: '^run-clm$'
209           only-trigger-phrase: false
210           status-context: 'CLM'
211           permit-all: true
212           github-hooks: true
213           included-regions: '{obj:github_included_regions}'
214
215 ########################
216 # Python Sonar with Tox #
217 ########################
218
219 - lf_tox_sonar: &lf_tox_sonar
220     name: lf-tox_sonar
221
222     ######################
223     # Default parameters #
224     ######################
225
226     branch: master  # Sonar should always be run on master branch
227     build-days-to-keep: 7
228     build-timeout: 60
229     cron: 'H H * * *'  # run daily
230     git-url: '$GIT_URL/$PROJECT'
231     java-version: openjdk8
232     python-version: python2
233     mvn-global-settings: global-settings
234     mvn-settings: '{mvn-settings}'
235     mvn-version: mvn35
236     sonar-mvn-goal: 'sonar:sonar'
237     stream: master
238     submodule-recursive: true
239
240     gerrit_trigger_file_paths:
241       - compare-type: REG_EXP
242         pattern: '.*'
243
244     # github_included_regions MUST match gerrit_trigger_file_paths
245     github_included_regions:
246       - '.*'
247
248     #####################
249     # Job Configuration #
250     #####################
251
252     parameters:
253       - lf-infra-parameters:
254           project: '{project}'
255           branch: '{branch}'
256           stream: '{stream}'
257           lftools-version: '{lftools-version}'
258       - string:
259           name: ARCHIVE_ARTIFACTS
260           default: '{archive-artifacts}'
261           description: Artifacts to archive to the logs server.
262       - string:
263           name: MVN
264           # Sets an env var for shell scripts to be able to call the dynamically
265           # installed maven without having to calculate the path themselves.
266           # yamllint disable-line rule:line-length
267           default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{mvn-version}/bin/mvn'
268           description: 'Maven selector to be used by shell scripts'
269       - string:
270           name: SONAR_MAVEN_GOAL
271           default: '{sonar-mvn-goal}'
272           description: |
273               Maven goals to pass to the Sonar call. Typically sonar:sonar
274               however to use a specific version of the sonar-maven-plugin we
275               can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar".
276
277     builders:
278       - shell: !include-raw-escape:
279           # Workaround issue where the tox run later breaks the lftools virtualenv.
280           # Without running the install first the run in the publisher will fail
281           # due to missing lftools because it gets installed into a tox venv.
282           - ../shell/lftools-install.sh
283       - lf-infra-tox-install:
284           python-version: '{python-version}'
285       - shell: !include-raw-escape: ../shell/tox-run.sh
286       - lf-provide-maven-settings:
287           global-settings-file: '{mvn-global-settings}'
288           settings-file: '{mvn-settings}'
289       - lf-infra-tox-sonar:
290           java-version: '{java-version}'
291           mvn-settings: '{mvn-settings}'
292           mvn-version: '{mvn-version}'
293
294     publishers:
295       - lf-infra-publish
296
297 - builder:
298     name: lf-infra-tox-sonar
299     # Run a Sonar build with Maven
300     builders:
301       - lf-maven-install:
302           mvn-version: '{mvn-version}'
303       - lf-update-java-alternatives:
304           java-version: '{java-version}'
305       - inject:
306           # TODO: Switch this to the sonar wrapper when JJB 2.0 is available
307           properties-content: SONAR_HOST_URL=$SONAR_URL
308       - shell: !include-raw-escape:
309           - ../shell/common-variables.sh
310           - ../shell/maven-sonar.sh
311       - lf-provide-maven-settings-cleanup
312
313 - job-template:
314     name: '{project-name}-tox-sonar'
315     id: gerrit-tox-sonar
316     <<: *lf_python_common
317     # yamllint disable-line rule:key-duplicates
318     <<: *lf_tox_sonar
319
320     ######################
321     # Default parameters #
322     ######################
323
324     gerrit_sonar_triggers:
325       - comment-added-contains-event:
326           comment-contains-value: run-sonar$
327
328     #####################
329     # Job Configuration #
330     #####################
331
332     scm:
333       - lf-infra-gerrit-scm:
334           jenkins-ssh-credential: '{jenkins-ssh-credential}'
335           git-url: '{git-url}'
336           refspec: $GERRIT_REFSPEC
337           branch: $GERRIT_BRANCH
338           submodule-recursive: '{submodule-recursive}'
339           choosing-strategy: default
340
341     triggers:
342       - timed: '{obj:cron}'
343       - gerrit:
344           server-name: '{gerrit-server-name}'
345           trigger-on: '{obj:gerrit_sonar_triggers}'
346           projects:
347             - project-compare-type: 'ANT'
348               project-pattern: '{project}'
349               branches:
350                 - branch-compare-type: 'ANT'
351                   branch-pattern: '**/{branch}'
352               file-paths: '{obj:gerrit_trigger_file_paths}'
353           skip-vote:
354             successful: true
355             failed: true
356             unstable: true
357             notbuilt: true
358
359 - job-template:
360     name: '{project-name}-tox-sonar'
361     id: github-tox-sonar
362     <<: *lf_python_common
363     # yamllint disable-line rule:key-duplicates
364     <<: *lf_tox_sonar
365
366     properties:
367       - github:
368           url: '{git-url}/{github-org}/{project}'
369
370     scm:
371       - lf-infra-github-scm:
372           url: '{git-clone-url}{github-org}/{project}'
373           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
374           branch: '$sha1'
375           submodule-recursive: '{submodule-recursive}'
376           choosing-strategy: default
377           jenkins-ssh-credential: '{jenkins-ssh-credential}'
378
379     triggers:
380       - github-pull-request:
381           trigger-phrase: '^run-sonar$'
382           only-trigger-phrase: false
383           status-context: 'Python Sonar'
384           permit-all: true
385           github-hooks: true
386           included-regions: '{obj:github_included_regions}'
387
388 ##############
389 # Tox Verify #
390 ##############
391
392 - lf_tox_verify: &lf_tox_verify
393     name: lf-tox-verify
394
395     ######################
396     # Default parameters #
397     ######################
398
399     branch: master
400     build-days-to-keep: 7
401     build-timeout: 15
402     git-url: '$GIT_URL/$GERRIT_PROJECT'
403     parallel: true
404     python-version: python2
405     stream: master
406     submodule-recursive: true
407     tox-dir: ''
408     tox-envs: ''
409
410     gerrit_trigger_file_paths:
411       - compare-type: REG_EXP
412         pattern: '.*'
413
414     # github_included_regions MUST match gerrit_trigger_file_paths
415     github_included_regions:
416       - '.*'
417
418     #####################
419     # Job Configuration #
420     #####################
421
422     project-type: freestyle
423     node: '{build-node}'
424     concurrent: true
425
426     properties:
427       - lf-infra-properties:
428           build-days-to-keep: '{build-days-to-keep}'
429
430     parameters:
431       - lf-infra-parameters:
432           project: '{project}'
433           branch: '{branch}'
434           stream: '{stream}'
435           lftools-version: '{lftools-version}'
436       - lf-infra-tox-parameters:
437           tox-dir: '{tox-dir}'
438           tox-envs: '{tox-envs}'
439       - bool:
440           name: PARALLEL
441           default: '{parallel}'
442           description: Tox test type used to configure serial or parallel testing.
443
444     wrappers:
445       - lf-infra-wrappers:
446           build-timeout: '{build-timeout}'
447           jenkins-ssh-credential: '{jenkins-ssh-credential}'
448
449     builders:
450       - shell: !include-raw-escape:
451           # Workaround issue where the tox run later breaks the lftools virtualenv.
452           # Without running the install first the run in the publisher will fail
453           # due to missing lftools because it gets installed into a tox venv.
454           - ../shell/lftools-install.sh
455       - lf-infra-tox-install:
456           python-version: '{python-version}'
457       - shell: !include-raw-escape: ../shell/tox-run.sh
458
459     publishers:
460       - lf-infra-publish
461
462 - job-template:
463     # Python projects typically use tox to run testing.
464     name: '{project-name}-tox-verify-{stream}'
465     id: gerrit-tox-verify
466     <<: *lf_tox_verify
467
468     ######################
469     # Default parameters #
470     ######################
471
472     gerrit_verify_triggers:
473       - patchset-created-event:
474           exclude-drafts: true
475           exclude-trivial-rebase: false
476           exclude-no-code-change: false
477       - draft-published-event
478       - comment-added-contains-event:
479           comment-contains-value: recheck$
480
481     #####################
482     # Job Configuration #
483     #####################
484
485     scm:
486       - lf-infra-gerrit-scm:
487           jenkins-ssh-credential: '{jenkins-ssh-credential}'
488           git-url: '{git-url}'
489           refspec: '$GERRIT_REFSPEC'
490           branch: '$GERRIT_BRANCH'
491           submodule-recursive: '{submodule-recursive}'
492           choosing-strategy: gerrit
493
494     triggers:
495       - gerrit:
496           server-name: '{gerrit-server-name}'
497           trigger-on: '{obj:gerrit_verify_triggers}'
498           projects:
499             - project-compare-type: ANT
500               project-pattern: '{project}'
501               branches:
502                 - branch-compare-type: ANT
503                   branch-pattern: '**/{branch}'
504               file-paths: '{obj:gerrit_trigger_file_paths}'
505
506 - job-template:
507     # Python projects typically use tox to run testing.
508     name: '{project-name}-tox-verify-{stream}'
509     id: github-tox-verify
510     <<: *lf_tox_verify
511
512     properties:
513       - github:
514           url: '{git-url}/{github-org}/{project}'
515
516     scm:
517       - lf-infra-github-scm:
518           url: '{git-clone-url}{github-org}/{project}'
519           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
520           branch: '$sha1'
521           submodule-recursive: '{submodule-recursive}'
522           choosing-strategy: default
523           jenkins-ssh-credential: '{jenkins-ssh-credential}'
524
525     triggers:
526       - github-pull-request:
527           trigger-phrase: '^recheck$'
528           only-trigger-phrase: false
529           status-context: 'Tox Verify'
530           permit-all: true
531           github-hooks: true
532           included-regions: '{obj:github_included_regions}'