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