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