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