2 # This file contains job templates for Maven projects.
5 name: '{project-name}-maven-jobs'
7 # This job group contains all the recommended jobs that should be deployed
12 - gerrit-maven-release
16 name: '{project-name}-github-maven-jobs'
18 # This job group contains all the recommended jobs that should be deployed
19 # for any project ci that is using github.
23 - github-maven-release
30 - lf_maven_common: &lf_maven_common
33 project-type: freestyle
38 - lf-infra-properties:
39 build-days-to-keep: '{build-days-to-keep}'
42 - lf-infra-parameters:
46 lftools-version: '{lftools-version}'
47 - lf-infra-maven-parameters:
48 mvn-opts: '{mvn-opts}'
49 mvn-params: '{mvn-params}'
50 mvn-version: '{mvn-version}'
51 # Staging repos do not make sense for CLM jobs so set it blank.
52 staging-profile-id: '{staging-profile-id}'
56 build-timeout: '{build-timeout}'
57 jenkins-ssh-credential: '{jenkins-ssh-credential}'
60 # TODO: Make email notification work.
61 # - lf-infra-email-notify:
62 # email-recipients: '{email-recipients}'
63 # email-prefix: '[releng]'
70 - lf_maven_clm: &lf_maven_clm
73 # Produces a CLM scan of the code into Nexus IQ Server.
75 # Required parameters:
76 # build-node: The node to run build on.
77 # jenkins-ssh-credential: Credential to use for SSH. (Generally should
78 # be configured in defaults.yaml)
79 # mvn-settings: The name of settings file containing credentials for
82 # Optional parameters:
83 # mvn-global-settings: The name of the Maven global settings to use for
84 # Maven configuration. (default: global-settings)
86 ######################
87 # Default parameters #
88 ######################
91 build-days-to-keep: 30 # 30 days for troubleshooting purposes
93 git-url: '$GIT_URL/$PROJECT'
94 java-version: openjdk8
95 mvn-global-settings: global-settings
100 submodule-recursive: true
102 # Staging repos do not make sense for CLM jobs so set it blank.
103 staging-profile-id: ''
105 #####################
106 # Job Configuration #
107 #####################
110 # Build weekly on Saturdays
115 mvn-version: '{mvn-version}'
116 - lf-provide-maven-settings:
117 global-settings-file: '{mvn-global-settings}'
118 settings-file: '{mvn-settings}'
119 - shell: !include-raw-escape:
120 - ../shell/common-variables.sh
121 - ../shell/sonatype-clm.sh
122 - lf-provide-maven-settings-cleanup
123 - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
125 application-name: '{project-name}'
128 name: '{project-name}-maven-clm-{stream}'
131 # yamllint disable-line rule:key-duplicates
135 - lf-infra-gerrit-scm:
136 jenkins-ssh-credential: '{jenkins-ssh-credential}'
138 refspec: '$GERRIT_REFSPEC'
139 branch: '$GERRIT_BRANCH'
140 submodule-recursive: '{submodule-recursive}'
141 choosing-strategy: default
144 name: '{project-name}-maven-clm-{stream}'
147 # yamllint disable-line rule:key-duplicates
152 url: '{git-url}/{github-org}/{project}'
155 - lf-infra-github-scm:
156 url: '{git-clone-url}{github-org}/{project}'
157 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
159 submodule-recursive: '{submodule-recursive}'
160 choosing-strategy: default
161 jenkins-ssh-credential: '{jenkins-ssh-credential}'
167 - lf_maven_release: &lf_maven_release
168 name: lf-maven-release
170 # Produces a release candidate by creating a staging repo in Nexus.
172 # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
173 # directory can then be reused later to deploy to Nexus.
175 # Required parameters:
176 # build-node: The node to run build on.
177 # jenkins-ssh-credential: Credential to use for SSH. (Generally should
178 # be configured in defaults.yaml)
179 # mvn-settings: The name of settings file containing credentials for
181 # staging-profile-id: Profile ID of the project's Nexus staging profile.
183 # Optional parameters:
184 # mvn-global-settings: The name of the Maven global settings to use for
185 # Maven configuration. (default: global-settings)
187 ######################
188 # Default parameters #
189 ######################
192 build-days-to-keep: 30 # 30 days in case a release takes long to get approved.
194 git-url: '$GIT_URL/$PROJECT'
195 java-version: openjdk8
196 mvn-global-settings: global-settings
201 submodule-recursive: true
203 #####################
204 # Job Configuration #
205 #####################
208 - lf-jacoco-nojava-workaround
210 mvn-version: '{mvn-version}'
211 - lf-provide-maven-settings:
212 global-settings-file: '{mvn-global-settings}'
213 settings-file: '{mvn-settings}'
214 - lf-infra-create-netrc:
215 server-id: opendaylight-staging
216 - shell: !include-raw-escape:
217 - ../shell/lftools-install.sh
218 - ../shell/common-variables.sh
219 - ../shell/maven-patch-release.sh
220 - ../shell/maven-build.sh
221 - ../shell/maven-stage.sh
222 - lf-provide-maven-settings-cleanup
225 name: '{project-name}-maven-release-{stream}'
226 id: gerrit-maven-release
228 # yamllint disable-line rule:key-duplicates
229 <<: *lf_maven_release
232 - lf-infra-gerrit-scm:
233 jenkins-ssh-credential: '{jenkins-ssh-credential}'
235 refspec: '$GERRIT_REFSPEC'
236 branch: '$GERRIT_BRANCH'
237 submodule-recursive: '{submodule-recursive}'
238 choosing-strategy: default
241 name: '{project-name}-maven-release-{stream}'
242 id: github-maven-release
244 # yamllint disable-line rule:key-duplicates
245 <<: *lf_maven_release
249 url: '{git-url}/{github-org}/{project}'
252 - lf-infra-github-scm:
253 url: '{git-clone-url}{github-org}/{project}'
254 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
256 submodule-recursive: '{submodule-recursive}'
257 choosing-strategy: default
258 jenkins-ssh-credential: '{jenkins-ssh-credential}'
264 - lf_maven_sonar: &lf_maven_sonar
267 # Sonar job which runs mvn clean install then publishes to Sonar.
269 # This job purposely only runs on the master branch as there are Additional
270 # configuration needed to support multiple branches and there's not much
271 # interest in that kind of support.
273 # Required parameters:
275 # :build-node: The node to run build on.
276 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
277 # be configured in defaults.yaml)
278 # :mvn-settings: The name of settings file containing credentials for
281 # Optional parameters:
283 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
284 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
285 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
286 # :java-version: Version of Java to use for the build. (default: openjdk8)
287 # :mvn-global-settings: The name of the Maven global settings to use for
288 # Maven configuration. (default: global-settings)
289 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
290 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
291 # :mvn-version: Version of maven to use. (default: mvn33)
292 # :submodule-recursive: Whether to checkout submodules recursively.
295 # :gerrit_sonar_triggers: Override Gerrit Triggers.
297 ######################
298 # Default parameters #
299 ######################
301 branch: master # Sonar should always be run on master branch
302 build-days-to-keep: 7
304 git-url: '$GIT_URL/$PROJECT'
305 java-version: openjdk8
306 mvn-global-settings: global-settings
311 submodule-recursive: true
313 gerrit_sonar_triggers:
314 - comment-added-contains-event:
315 comment-contains-value: run-sonar$
317 # Staging repos do not make sense for CLM jobs so set it blank.
318 staging-profile-id: ''
320 #####################
321 # Job Configuration #
322 #####################
327 server-name: '{gerrit-server-name}'
328 trigger-on: '{obj:gerrit_sonar_triggers}'
330 - project-compare-type: 'ANT'
331 project-pattern: '{project}'
333 - branch-compare-type: 'ANT'
334 branch-pattern: '**/master'
342 - lf-infra-maven-sonar:
343 mvn-settings: '{mvn-settings}'
344 mvn-version: '{mvn-version}'
352 name: lf-infra-maven-sonar
353 # Run a Sonar build with Maven
356 mvn-version: '{mvn-version}'
358 # Switch this to the sonar wrapper when JJB 2.0 is available
359 properties-content: |
360 SONAR_HOST_URL=$SONAR_URL
361 SONAR_MAVEN_GOAL=sonar:sonar
362 - lf-provide-maven-settings:
363 global-settings-file: global-settings
364 settings-file: '{mvn-settings}'
365 - shell: !include-raw-escape:
366 - ../shell/common-variables.sh
367 - ../shell/maven-sonar.sh
368 - lf-provide-maven-settings-cleanup
371 name: '{project-name}-sonar'
372 id: gerrit-maven-sonar
374 # yamllint disable-line rule:key-duplicates
378 - lf-infra-gerrit-scm:
379 jenkins-ssh-credential: '{jenkins-ssh-credential}'
381 refspec: $GERRIT_REFSPEC
382 branch: $GERRIT_BRANCH
383 submodule-recursive: '{submodule-recursive}'
384 choosing-strategy: default
387 name: '{project-name}-sonar'
388 id: github-maven-sonar
390 # yamllint disable-line rule:key-duplicates
395 url: '{git-url}/{github-org}/{project}'
398 - lf-infra-github-scm:
399 url: '{git-clone-url}{github-org}/{project}'
400 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
402 submodule-recursive: '{submodule-recursive}'
403 choosing-strategy: default
404 jenkins-ssh-credential: '{jenkins-ssh-credential}'
407 - lf-infra-github-pr-trigger:
408 trigger-phrase: '^recheck$'
409 only-trigger-phrase: false
410 status-context: 'Maven Verify'
416 github_pr_admin_list:
423 - lf_maven_verify: &lf_maven_verify
424 name: lf-maven-verify
426 # Verify job which runs mvn clean install to test a project build..
428 # Required parameters:
430 # :build-node: The node to run build on.
431 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
432 # be configured in defaults.yaml)
433 # :mvn-settings: The name of settings file containing credentials for
436 # Optional parameters:
438 # :branch: Git branch to fetch for the build. (default: master)
439 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
440 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
441 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
442 # :java-version: Version of Java to use for the build. (default: openjdk8)
443 # :mvn-global-settings: The name of the Maven global settings to use for
444 # Maven configuration. (default: global-settings)
445 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
446 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
447 # :mvn-version: Version of maven to use. (default: mvn33)
448 # :stream: Keyword that can be used to represent a release code-name.
449 # Often the same as the branch. (default: master)
450 # :submodule-recursive: Whether to checkout submodules recursively.
453 # :gerrit_verify_triggers: Override Gerrit Triggers.
454 # :gerrit_trigger_file_paths: Override file paths which can be used to
455 # filter which file modifications will trigger a build.
457 ######################
458 # Default parameters #
459 ######################
462 build-days-to-keep: 7
464 git-url: '$GIT_URL/$PROJECT'
465 java-version: openjdk8
466 mvn-global-settings: global-settings
468 mvn-params: '-Dstream=$STREAM'
471 submodule-recursive: true
473 gerrit_verify_triggers:
474 - patchset-created-event:
475 exclude-drafts: false
476 exclude-trivial-rebase: false
477 exclude-no-code-change: false
478 - draft-published-event
479 - comment-added-contains-event:
480 comment-contains-value: recheck$
481 gerrit_trigger_file_paths:
485 #####################
486 # Job Configuration #
487 #####################
492 - lf-jacoco-nojava-workaround
494 mvn-version: '{mvn-version}'
495 - lf-provide-maven-settings:
496 global-settings-file: '{mvn-global-settings}'
497 settings-file: '{mvn-settings}'
498 - shell: !include-raw-escape:
499 - ../shell/lftools-install.sh
500 - ../shell/common-variables.sh
501 - ../shell/maven-build.sh
502 - lf-provide-maven-settings-cleanup
510 name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
511 id: gerrit-maven-verify
513 # yamllint disable-line rule:key-duplicates
517 - lf-infra-gerrit-scm:
518 jenkins-ssh-credential: '{jenkins-ssh-credential}'
520 refspec: '$GERRIT_REFSPEC'
521 branch: '$GERRIT_BRANCH'
522 submodule-recursive: '{submodule-recursive}'
523 choosing-strategy: gerrit
527 server-name: '{gerrit-server-name}'
528 trigger-on: '{obj:gerrit_verify_triggers}'
530 - project-compare-type: ANT
531 project-pattern: '{project}'
533 - branch-compare-type: ANT
534 branch-pattern: '**/{branch}'
535 file-paths: '{obj:gerrit_trigger_file_paths}'
538 name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
539 id: github-maven-verify
541 # yamllint disable-line rule:key-duplicates
546 url: '{git-url}/{github-org}/{project}'
549 - lf-infra-github-scm:
550 url: '{git-clone-url}{github-org}/{project}'
551 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
553 submodule-recursive: '{submodule-recursive}'
554 choosing-strategy: default
555 jenkins-ssh-credential: '{jenkins-ssh-credential}'
558 - lf-infra-github-pr-trigger:
559 trigger-phrase: '^recheck$'
560 only-trigger-phrase: false
561 status-context: 'Maven Verify'
567 github_pr_admin_list: