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