blob: d39c1f6b3f63391e08d86e963731a2366ed0729b [file] [log] [blame]
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -07001---
Zack Williamsc3c83932018-10-30 13:56:37 -07002# maven jobs for Java projects
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -07003
4- job-template:
Zack Williams866ef3c2019-09-27 15:41:02 -07005 id: maven-test
6 name: 'verify_{project}_maven-test{name-extension}'
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -07007 description: |
8 <!-- Managed by Jenkins Job Builder -->
Kailash Khalasi45f4e2c2018-05-09 14:09:50 -07009 Created by {id} job-template from ci-management/jjb/maven.yaml
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -070010
11 node: 'ubuntu16.04-basebuild-1c-2g'
Matteo Scandolo00240382018-11-26 14:42:32 -080012 project-type: freestyle
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -070013
Kailash Khalasif3f15bd2018-05-09 09:58:52 -070014 parameters:
15 - string:
hwchiu14f97852019-10-08 10:51:11 -070016 name: jdkDistro
17 default: '{jdk-distribution}'
18 description: 'Distribution of the JDK to use with update-java-alternatives'
Zack Williams234dc922019-08-30 17:03:57 -070019
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -070020 triggers:
21 - cord-infra-gerrit-trigger-patchset:
22 gerrit-server-name: '{gerrit-server-name}'
Kailash Khalasi45f4e2c2018-05-09 14:09:50 -070023 project-regexp: '{project}'
Kailash Khalasi69c8fcd2018-05-09 09:43:49 -070024 branch-regexp: '{branch-regexp}'
25 file-include-regexp: '{all-files-regexp}'
26 dependency-jobs: '{dependency-jobs}'
27
28 properties:
29 - cord-infra-properties:
30 build-days-to-keep: '{build-days-to-keep}'
31 artifact-num-to-keep: '{artifact-num-to-keep}'
Kailash Khalasia5ca0c72018-05-09 12:00:21 -070032
33 scm:
Zack Williams866ef3c2019-09-27 15:41:02 -070034 - lf-infra-gerrit-scm:
35 git-url: '$GIT_URL/$GERRIT_PROJECT'
Kailash Khalasi45f4e2c2018-05-09 14:09:50 -070036 refspec: '$GERRIT_REFSPEC'
Zack Williams866ef3c2019-09-27 15:41:02 -070037 branch: '$GERRIT_BRANCH'
38 submodule-recursive: 'false'
39 choosing-strategy: gerrit
40 jenkins-ssh-credential: '{jenkins-ssh-credential}'
Zack Williamsc3c83932018-10-30 13:56:37 -070041
Matteo Scandolo00240382018-11-26 14:42:32 -080042 builders:
Zack Williams866ef3c2019-09-27 15:41:02 -070043 # Set JDK version
Zack Williams234dc922019-08-30 17:03:57 -070044 - shell: |
45 #!/usr/bin/env bash
46 set -eu -o pipefail
47 echo "Setting JDK Distro to: $jdkDistro"
Zack Williamsbfe83862019-09-19 22:18:04 -070048 sudo update-java-alternatives -s $jdkDistro
Zack Williams234dc922019-08-30 17:03:57 -070049 echo "Java Version:"
50 java -version
51
Zack Williams866ef3c2019-09-27 15:41:02 -070052 # run tests and install
Matteo Scandolo00240382018-11-26 14:42:32 -080053 - maven-target:
54 pom: pom.xml
Matteo Scandolob9b70df2019-10-31 09:36:44 -070055 settings: 'cord-apps-maven-settings'
Zack Williams866ef3c2019-09-27 15:41:02 -070056 settings-type: cfp
57 goals: 'clean test install'
58
59 publishers:
60 - junit:
61 results: "**/TEST-*.xml"
62 allow-empty-results: '{junit-allow-empty-results}'
63 - cobertura:
64 report-file: "**/*coverage.xml"
65 targets:
66 - files:
67 healthy: 80
68 unhealthy: 0
69 failing: 0
70 - method:
71 healthy: 50
72 unhealthy: 0
73 failing: 0
Matteo Scandolo00240382018-11-26 14:42:32 -080074
Matteo Scandolo23cde382019-05-22 17:00:43 -070075- job-template:
Zack Williams866ef3c2019-09-27 15:41:02 -070076 id: maven-publish
77 name: 'maven-publish{name-extension}_{project}'
Matteo Scandolo23cde382019-05-22 17:00:43 -070078 description: |
79 <!-- Managed by Jenkins Job Builder -->
80 Created by {id} job-template from ci-management/jjb/maven.yaml
81
82 node: 'ubuntu16.04-basebuild-1c-2g'
83 project-type: freestyle
84
85 parameters:
86 - string:
hwchiu14f97852019-10-08 10:51:11 -070087 name: jdkDistro
88 default: '{jdk-distribution}'
89 description: 'Distribution of the JDK to use with update-java-alternatives'
Zack Williams234dc922019-08-30 17:03:57 -070090
Matteo Scandolo23cde382019-05-22 17:00:43 -070091 triggers:
92 - cord-infra-gerrit-trigger-merge:
93 gerrit-server-name: '{gerrit-server-name}'
94 project-regexp: '{project}'
95 branch-regexp: '{branch-regexp}'
96 file-include-regexp: '{all-files-regexp}'
97 dependency-jobs: '{dependency-jobs}'
98
99 properties:
100 - cord-infra-properties:
101 build-days-to-keep: '{build-days-to-keep}'
102 artifact-num-to-keep: '{artifact-num-to-keep}'
103
104 scm:
Matteo Scandolo9de9dcf2019-10-30 15:43:50 -0700105 - lf-infra-gerrit-scm:
Zack Williams866ef3c2019-09-27 15:41:02 -0700106 git-url: '$GIT_URL/$GERRIT_PROJECT'
Matteo Scandolo23cde382019-05-22 17:00:43 -0700107 refspec: '$GERRIT_REFSPEC'
Zack Williams866ef3c2019-09-27 15:41:02 -0700108 branch: '$GERRIT_BRANCH'
109 submodule-recursive: 'false'
110 choosing-strategy: gerrit
111 jenkins-ssh-credential: '{jenkins-ssh-credential}'
Matteo Scandolo23cde382019-05-22 17:00:43 -0700112
Zack Williams15cbd7e2019-10-30 13:01:39 -0700113 wrappers:
114 - credentials-binding:
115 - file:
116 credential-id: 'gpg-creds-maven'
117 variable: 'GNUPG'
118
Matteo Scandolo23cde382019-05-22 17:00:43 -0700119 builders:
Zack Williams866ef3c2019-09-27 15:41:02 -0700120 # Set JDK version
Zack Williams234dc922019-08-30 17:03:57 -0700121 - shell: |
122 #!/usr/bin/env bash
123 set -eu -o pipefail
124 echo "Setting JDK Distro to: $jdkDistro"
Zack Williamsbfe83862019-09-19 22:18:04 -0700125 sudo update-java-alternatives -s $jdkDistro
Zack Williams234dc922019-08-30 17:03:57 -0700126 echo "Java Version:"
127 java -version
Zack Williams15cbd7e2019-10-30 13:01:39 -0700128 echo "Unpacking GPG Keys"
129 tar -xvf $GNUPG -C ~
Zack Williams234dc922019-08-30 17:03:57 -0700130
Matteo Scandolo23cde382019-05-22 17:00:43 -0700131 - maven-target:
Matteo Scandolo9de9dcf2019-10-30 15:43:50 -0700132 pom: pom.xml
Matteo Scandolob9b70df2019-10-31 09:36:44 -0700133 settings: 'cord-apps-maven-settings'
Matteo Scandoloe7ee33c2019-05-23 13:23:13 -0700134 settings-type: cfp
Matteo Scandolo864e5a82019-10-31 10:27:17 -0700135 goals: '-Prelease clean deploy'