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