Merge "Pass common maven options to deploy file builder"
[releng/global-jjb.git] / jjb / lf-maven-jobs.yaml
1 ---
2 # This file contains job templates for Maven projects.
3
4 - job-group:
5     name: '{project-name}-maven-jobs'
6
7     # This job group contains all the recommended jobs that should be deployed
8     # for any project ci.
9
10     jobs:
11       - gerrit-maven-clm
12       - gerrit-maven-release
13
14 - job-group:
15     name: '{project-name}-github-maven-jobs'
16
17     # This job group contains all the recommended jobs that should be deployed
18     # for any project ci that is using github.
19
20     jobs:
21       - github-maven-clm
22       - github-maven-release
23
24 ####################
25 # Anchors & Macros #
26 ####################
27
28 - lf_maven_clm: &lf_maven_clm
29     name: lf-maven-clm
30
31     # Produces a CLM scan of the code into Nexus IQ Server.
32     #
33     # Required parameters:
34     #     build-node:    The node to run build on.
35     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
36     #                             be configured in defaults.yaml)
37     #     mvn-settings: The name of settings file containing credentials for
38     #                   the project.
39     #
40     # Optional parameters:
41     #     mvn-global-settings: The name of the Maven global settings to use for
42     #                          Maven configuration. (default: global-settings)
43
44     project-type: freestyle
45     node: '{build-node}'
46     jdk: '{java-version}'
47
48     ######################
49     # Default parameters #
50     ######################
51
52     branch: master
53     build-timeout: 15
54     git-url: '$GIT_URL/$PROJECT'
55     java-version: openjdk8
56     mvn-global-settings: global-settings
57     mvn-opts: ''
58     mvn-params: ''
59     mvn-version: mvn33
60     stream: master
61     submodule-recursive: true
62
63     #####################
64     # Job Configuration #
65     #####################
66
67     properties:
68       - lf-infra-properties:
69           # Keep around for 30 days for troubleshooting purposes.
70           build-days-to-keep: 30
71
72     parameters:
73       - lf-infra-parameters:
74           project: '{project}'
75           branch: '{branch}'
76           stream: '{stream}'
77       - lf-infra-maven-parameters:
78           mvn-opts: '{mvn-opts}'
79           mvn-params: '{mvn-params}'
80           mvn-version: '{mvn-version}'
81           # Staging repos do not make sense for CLM jobs so set it blank.
82           staging-profile-id: ''
83
84     wrappers:
85       - lf-infra-wrappers:
86           build-timeout: '{build-timeout}'
87           jenkins-ssh-credential: '{jenkins-ssh-credential}'
88
89     triggers:
90       # Build weekly on Saturdays
91       - timed: 'H H * * 6'
92
93     builders:
94       - lf-maven-install:
95           mvn-version: '{mvn-version}'
96       - lf-provide-maven-settings:
97           global-settings-file: '{mvn-global-settings}'
98           settings-file: '{mvn-settings}'
99       - shell: !include-raw-escape:
100           - ../shell/lftools-install.sh
101           - ../shell/common-variables.sh
102           - ../shell/sonatype-clm.sh
103       - lf-provide-maven-settings-cleanup
104       - shell: 'find . -regex ".*karaf/target" | xargs rm -rf'
105       - sonatype-clm:
106           application-name: '{project-name}'
107
108     publishers:
109       - lf-infra-publish
110
111 - lf_maven_release: &lf_maven_release
112     name: lf-maven-release
113
114     # Produces a release candidate by creating a staging repo in Nexus.
115     #
116     # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
117     # directory can then be reused later to deploy to Nexus.
118     #
119     # Required parameters:
120     #     build-node:    The node to run build on.
121     #     jenkins-ssh-credential: Credential to use for SSH. (Generally should
122     #                             be configured in defaults.yaml)
123     #     mvn-settings: The name of settings file containing credentials for
124     #                   the project.
125     #     staging-profile-id: Profile ID of the project's Nexus staging profile.
126     #
127     # Optional parameters:
128     #     mvn-global-settings: The name of the Maven global settings to use for
129     #                          Maven configuration. (default: global-settings)
130
131     project-type: freestyle
132     node: '{build-node}'
133     jdk: '{java-version}'
134
135     ######################
136     # Default parameters #
137     ######################
138
139     branch: master
140     build-timeout: 30
141     git-url: '$GIT_URL/$PROJECT'
142     java-version: openjdk8
143     mvn-global-settings: global-settings
144     mvn-opts: ''
145     mvn-params: ''
146     mvn-version: mvn33
147     stream: master
148     submodule-recursive: true
149
150     #####################
151     # Job Configuration #
152     #####################
153
154     properties:
155       - lf-infra-properties:
156           # Keep around for 30 days in case a release takes long to get approved.
157           build-days-to-keep: 30
158
159     parameters:
160       - lf-infra-parameters:
161           project: '{project}'
162           branch: '{branch}'
163           stream: '{stream}'
164       - lf-infra-maven-parameters:
165           mvn-opts: '{mvn-opts}'
166           mvn-params: '{mvn-params}'
167           mvn-version: '{mvn-version}'
168           staging-profile-id: '{staging-profile-id}'
169
170     wrappers:
171       - lf-infra-wrappers:
172           build-timeout: '{build-timeout}'
173           jenkins-ssh-credential: '{jenkins-ssh-credential}'
174
175     builders:
176       - lf-jacoco-nojava-workaround
177       - lf-maven-install:
178           mvn-version: '{mvn-version}'
179       - lf-provide-maven-settings:
180           global-settings-file: '{mvn-global-settings}'
181           settings-file: '{mvn-settings}'
182       - lf-infra-create-netrc:
183           server-id: opendaylight-staging
184       - shell: !include-raw-escape:
185           - ../shell/lftools-install.sh
186           - ../shell/common-variables.sh
187           - ../shell/maven-patch-release.sh
188           - ../shell/maven-build.sh
189           - ../shell/maven-stage.sh
190       - lf-provide-maven-settings-cleanup
191
192     publishers:
193       # TODO: Make email notification work.
194       # - lf-infra-email-notify:
195       #     email-recipients: '{email-recipients}'
196       #     email-prefix: '[releng]'
197       - lf-infra-publish
198
199
200 #################
201 # Job Templates #
202 #################
203
204 - job-template:
205     name: '{project-name}-maven-clm-{stream}'
206     id: gerrit-maven-clm
207     <<: *lf_maven_clm
208
209     scm:
210       - lf-infra-gerrit-scm:
211           jenkins-ssh-credential: '{jenkins-ssh-credential}'
212           git-url: '{git-url}'
213           refspec: '$GERRIT_REFSPEC'
214           branch: '$GERRIT_BRANCH'
215           submodule-recursive: '{submodule-recursive}'
216           choosing-strategy: default
217
218 - job-template:
219     name: '{project-name}-maven-clm-{stream}'
220     id: github-maven-clm
221     <<: *lf_maven_clm
222
223     properties:
224       - github:
225           url: '{git-url}/{github-org}/{project}'
226
227     scm:
228       - lf-infra-github-scm:
229           url: '{git-clone-url}{github-org}/{project}'
230           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
231           branch: '{branch}'
232           submodule-recursive: '{submodule-recursive}'
233           choosing-strategy: default
234           jenkins-ssh-credential: '{jenkins-ssh-credential}'
235
236 - job-template:
237     name: '{project-name}-maven-release-{stream}'
238     id: gerrit-maven-release
239     <<: *lf_maven_release
240
241     scm:
242       - lf-infra-gerrit-scm:
243           jenkins-ssh-credential: '{jenkins-ssh-credential}'
244           git-url: '{git-url}'
245           refspec: '$GERRIT_REFSPEC'
246           branch: '$GERRIT_BRANCH'
247           submodule-recursive: '{submodule-recursive}'
248           choosing-strategy: default
249
250 - job-template:
251     name: '{project-name}-maven-release-{stream}'
252     id: github-maven-release
253     <<: *lf_maven_release
254
255     properties:
256       - github:
257           url: '{git-url}/{github-org}/{project}'
258
259     scm:
260       - lf-infra-github-scm:
261           url: '{git-clone-url}{github-org}/{project}'
262           refspec: '+refs/pull/*:refs/remotes/origin/pr/*'
263           branch: '{branch}'
264           submodule-recursive: '{submodule-recursive}'
265           choosing-strategy: default
266           jenkins-ssh-credential: '{jenkins-ssh-credential}'