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