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 # :gerrit_verify_triggers: Override Gerrit Triggers.
185 # :mvn-global-settings: The name of the Maven global settings to use for
186 # Maven configuration. (default: global-settings)
188 ######################
189 # Default parameters #
190 ######################
193 build-days-to-keep: 30 # 30 days in case a release takes long to get approved.
195 git-url: '$GIT_URL/$PROJECT'
196 java-version: openjdk8
197 mvn-global-settings: global-settings
202 submodule-recursive: true
204 gerrit_release_triggers:
205 - comment-added-contains-event:
206 comment-contains-value: build release$
208 #####################
209 # Job Configuration #
210 #####################
213 - lf-jacoco-nojava-workaround
215 mvn-version: '{mvn-version}'
216 - lf-provide-maven-settings:
217 global-settings-file: '{mvn-global-settings}'
218 settings-file: '{mvn-settings}'
219 - lf-infra-create-netrc:
220 server-id: opendaylight-staging
221 - shell: !include-raw-escape:
222 - ../shell/lftools-install.sh
223 - ../shell/common-variables.sh
224 - ../shell/maven-patch-release.sh
225 - ../shell/maven-build.sh
226 - ../shell/maven-stage.sh
227 - lf-provide-maven-settings-cleanup
230 name: '{project-name}-maven-release-{stream}'
231 id: gerrit-maven-release
233 # yamllint disable-line rule:key-duplicates
234 <<: *lf_maven_release
237 - lf-infra-gerrit-scm:
238 jenkins-ssh-credential: '{jenkins-ssh-credential}'
240 refspec: '$GERRIT_REFSPEC'
241 branch: '$GERRIT_BRANCH'
242 submodule-recursive: '{submodule-recursive}'
243 choosing-strategy: default
247 server-name: '{gerrit-server-name}'
248 trigger-on: '{obj:gerrit_release_triggers}'
250 - project-compare-type: ANT
251 project-pattern: '{project}'
253 - branch-compare-type: ANT
254 branch-pattern: '**/{branch}'
257 name: '{project-name}-maven-release-{stream}'
258 id: github-maven-release
260 # yamllint disable-line rule:key-duplicates
261 <<: *lf_maven_release
265 url: '{git-url}/{github-org}/{project}'
268 - lf-infra-github-scm:
269 url: '{git-clone-url}{github-org}/{project}'
270 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
272 submodule-recursive: '{submodule-recursive}'
273 choosing-strategy: default
274 jenkins-ssh-credential: '{jenkins-ssh-credential}'
277 - lf-infra-github-pr-trigger:
278 trigger-phrase: '^build release$'
279 only-trigger-phrase: true
280 status-context: 'Maven Release'
286 github_pr_admin_list:
293 - lf_maven_sonar: &lf_maven_sonar
296 # Sonar job which runs mvn clean install then publishes to Sonar.
298 # This job purposely only runs on the master branch as there are Additional
299 # configuration needed to support multiple branches and there's not much
300 # interest in that kind of support.
302 # Required parameters:
304 # :build-node: The node to run build on.
305 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
306 # be configured in defaults.yaml)
307 # :mvn-settings: The name of settings file containing credentials for
310 # Optional parameters:
312 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
313 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
314 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
315 # :java-version: Version of Java to use for the build. (default: openjdk8)
316 # :mvn-global-settings: The name of the Maven global settings to use for
317 # Maven configuration. (default: global-settings)
318 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
319 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
320 # :mvn-version: Version of maven to use. (default: mvn33)
321 # :submodule-recursive: Whether to checkout submodules recursively.
324 # :gerrit_sonar_triggers: Override Gerrit Triggers.
326 ######################
327 # Default parameters #
328 ######################
330 branch: master # Sonar should always be run on master branch
331 build-days-to-keep: 7
333 git-url: '$GIT_URL/$PROJECT'
334 java-version: openjdk8
335 mvn-global-settings: global-settings
340 submodule-recursive: true
342 gerrit_sonar_triggers:
343 - comment-added-contains-event:
344 comment-contains-value: run-sonar$
346 # Staging repos do not make sense for CLM jobs so set it blank.
347 staging-profile-id: ''
349 #####################
350 # Job Configuration #
351 #####################
356 server-name: '{gerrit-server-name}'
357 trigger-on: '{obj:gerrit_sonar_triggers}'
359 - project-compare-type: 'ANT'
360 project-pattern: '{project}'
362 - branch-compare-type: 'ANT'
363 branch-pattern: '**/master'
371 - lf-infra-maven-sonar:
372 mvn-settings: '{mvn-settings}'
373 mvn-version: '{mvn-version}'
381 name: lf-infra-maven-sonar
382 # Run a Sonar build with Maven
385 mvn-version: '{mvn-version}'
387 # Switch this to the sonar wrapper when JJB 2.0 is available
388 properties-content: |
389 SONAR_HOST_URL=$SONAR_URL
390 SONAR_MAVEN_GOAL=sonar:sonar
391 - lf-provide-maven-settings:
392 global-settings-file: global-settings
393 settings-file: '{mvn-settings}'
394 - shell: !include-raw-escape:
395 - ../shell/common-variables.sh
396 - ../shell/maven-sonar.sh
397 - lf-provide-maven-settings-cleanup
400 name: '{project-name}-sonar'
401 id: gerrit-maven-sonar
403 # yamllint disable-line rule:key-duplicates
407 - lf-infra-gerrit-scm:
408 jenkins-ssh-credential: '{jenkins-ssh-credential}'
410 refspec: $GERRIT_REFSPEC
411 branch: $GERRIT_BRANCH
412 submodule-recursive: '{submodule-recursive}'
413 choosing-strategy: default
416 name: '{project-name}-sonar'
417 id: github-maven-sonar
419 # yamllint disable-line rule:key-duplicates
424 url: '{git-url}/{github-org}/{project}'
427 - lf-infra-github-scm:
428 url: '{git-clone-url}{github-org}/{project}'
429 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
431 submodule-recursive: '{submodule-recursive}'
432 choosing-strategy: default
433 jenkins-ssh-credential: '{jenkins-ssh-credential}'
436 - lf-infra-github-pr-trigger:
437 trigger-phrase: '^recheck$'
438 only-trigger-phrase: false
439 status-context: 'Maven Verify'
445 github_pr_admin_list:
452 - lf_maven_verify: &lf_maven_verify
453 name: lf-maven-verify
455 # Verify job which runs mvn clean install to test a project build..
457 # Required parameters:
459 # :build-node: The node to run build on.
460 # :jenkins-ssh-credential: Credential to use for SSH. (Generally should
461 # be configured in defaults.yaml)
462 # :mvn-settings: The name of settings file containing credentials for
465 # Optional parameters:
467 # :branch: Git branch to fetch for the build. (default: master)
468 # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
469 # :build-timeout: Timeout in seconds before aborting build. (default: 60)
470 # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
471 # :java-version: Version of Java to use for the build. (default: openjdk8)
472 # :mvn-global-settings: The name of the Maven global settings to use for
473 # Maven configuration. (default: global-settings)
474 # :mvn-opts: Sets MAVEN_OPTS. (default: '')
475 # :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
476 # :mvn-version: Version of maven to use. (default: mvn33)
477 # :stream: Keyword that can be used to represent a release code-name.
478 # Often the same as the branch. (default: master)
479 # :submodule-recursive: Whether to checkout submodules recursively.
482 # :gerrit_verify_triggers: Override Gerrit Triggers.
483 # :gerrit_trigger_file_paths: Override file paths which can be used to
484 # filter which file modifications will trigger a build.
486 ######################
487 # Default parameters #
488 ######################
491 build-days-to-keep: 7
493 git-url: '$GIT_URL/$PROJECT'
494 java-version: openjdk8
495 mvn-global-settings: global-settings
497 mvn-params: '-Dstream=$STREAM'
500 submodule-recursive: true
502 gerrit_verify_triggers:
503 - patchset-created-event:
504 exclude-drafts: false
505 exclude-trivial-rebase: false
506 exclude-no-code-change: false
507 - draft-published-event
508 - comment-added-contains-event:
509 comment-contains-value: recheck$
510 gerrit_trigger_file_paths:
514 #####################
515 # Job Configuration #
516 #####################
521 - lf-jacoco-nojava-workaround
523 mvn-version: '{mvn-version}'
524 - lf-provide-maven-settings:
525 global-settings-file: '{mvn-global-settings}'
526 settings-file: '{mvn-settings}'
527 - shell: !include-raw-escape:
528 - ../shell/lftools-install.sh
529 - ../shell/common-variables.sh
530 - ../shell/maven-build.sh
531 - lf-provide-maven-settings-cleanup
539 name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
540 id: gerrit-maven-verify
542 # yamllint disable-line rule:key-duplicates
546 - lf-infra-gerrit-scm:
547 jenkins-ssh-credential: '{jenkins-ssh-credential}'
549 refspec: '$GERRIT_REFSPEC'
550 branch: '$GERRIT_BRANCH'
551 submodule-recursive: '{submodule-recursive}'
552 choosing-strategy: gerrit
556 server-name: '{gerrit-server-name}'
557 trigger-on: '{obj:gerrit_verify_triggers}'
559 - project-compare-type: ANT
560 project-pattern: '{project}'
562 - branch-compare-type: ANT
563 branch-pattern: '**/{branch}'
564 file-paths: '{obj:gerrit_trigger_file_paths}'
567 name: '{project-name}-maven-verify-{stream}-{mvn-version}-{java-version}'
568 id: github-maven-verify
570 # yamllint disable-line rule:key-duplicates
575 url: '{git-url}/{github-org}/{project}'
578 - lf-infra-github-scm:
579 url: '{git-clone-url}{github-org}/{project}'
580 refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
582 submodule-recursive: '{submodule-recursive}'
583 choosing-strategy: default
584 jenkins-ssh-credential: '{jenkins-ssh-credential}'
587 - lf-infra-github-pr-trigger:
588 trigger-phrase: '^recheck$'
589 only-trigger-phrase: false
590 status-context: 'Maven Verify'
596 github_pr_admin_list: