Add triggers to UDS Build Job
[infra/cicd.git] / jjb / onap / uds / uds-daily-build-package-promote.yaml
1 # ============LICENSE_START=======================================================
2 #  Copyright (C) 2019 Nordix Foundation.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the 'License');
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an 'AS IS' BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # SPDX-License-Identifier: Apache-2.0
17 # ============LICENSE_END=========================================================
18 ---
19 - project:
20     name: 'uds-daily-build-package-promote'
21     projects: 'onap/sdc, local/onap/uds/sdc-customization'
22     project-name:
23       - uds
24     branches: 20.2, master
25     project_directories: sdc, sdc-customization
26     project_versions:
27     mvn_params: '-DskipTests -Pdocker'
28     # mvn_params: '-DskipTests -Pdocker' # re-enable when unit tests pass
29     mvn_settings_xml_version:
30     docker_images: '
31       uds/sdc-cassandra-init,
32       uds/sdc-backend-init,
33       uds/sdc-be-plugin/etsi-nfv-nsd-csar,
34       uds/sdc-be-plugin/vf-csar,
35       uds/sdc-customization/eo-sdc-backend-init,
36       uds/sdc-customization/eo-cassandra-init,
37       uds/sdc-backend,
38       uds/sdc-onboard-backend,
39       uds/sdc-frontend,
40       uds/sdc-cassandra,
41       uds/sdc-simulator
42     '
43     docker_image_artifact_directory: $WORKSPACE/artifacts/images
44     artifactory_docker_images_path: onap/uds/images
45     artifact_paths: 'sdc/catalog-be/target/catalog-be-*.war'
46     artifactory_artifact_path: onap/uds
47     artifact_directory: $WORKSPACE/artifacts/artifacts
48     artifactory_repo_archive_path: onap/uds/releases
49     repo_archive_artifact_directory: $WORKSPACE/artifacts/repos
50     grep_parameters: -oP (?<=uds.version>)[^<]+
51     archive_name: uds
52     pom_location: sdc/pom.xml
53     workspace: /home/jenkins/nordix/slave_root/workspace/
54     node: onap-uds-build-ubuntu1804
55
56     jobs:
57       - '{project-name}-daily-build-package-promote'
58       - '{project-name}-build'
59       - '{project-name}-package-artifacts'
60       - '{project-name}-package-images'
61       - '{project-name}-package-repositories'
62       - '{project-name}-promote-artifacts'
63       - '{project-name}-promote-images'
64       - '{project-name}-promote-repositories'
65
66
67 - job-template:
68     name: '{project-name}-daily-build-package-promote'
69     description: 'Job for building, packing and pushing UDS artifacts including sources, docker images and other arifacts to Artifactory'
70     project-type: 'multijob'
71     workspace: '{workspace}'
72     node: '{node}'
73     parameters:
74       - multi-project-parameters:
75           projects: '{projects}'
76           branches: '{branches}'
77           project_directories: '{project_directories}'
78           project_versions: '{project_versions}'
79       - git-parameters
80       - maven-parameters:
81           mvn_params: '{mvn_params}'
82           mvn_settings_xml_version: '{mvn_settings_xml_version}'
83       - artifact_parameters:
84           artifact_paths: '{artifact_paths}'
85           artifactory_artifact_path: '{artifactory_artifact_path}'
86           artifact_directory: '{artifact_directory}'
87       - artifactory-parameters
88       - docker-archive-parameters:
89           docker_images: '{docker_images}'
90           artifactory_docker_images_path: '{artifactory_docker_images_path}'
91           docker_image_artifact_directory: '{docker_image_artifact_directory}'
92       - repo-archive-parameters:
93           grep_parameters: '{grep_parameters}'
94           pom_location: '{pom_location}'
95           archive_name: '{archive_name}'
96           artifactory_repo_archive_path: '{artifactory_repo_archive_path}'
97           repo_archive_artifact_directory: '{repo_archive_artifact_directory}'
98
99     builders:
100       - 'pull-source-repositories'
101       - 'generate-build-metadata'
102       - multijob:
103           name: Build
104           condition: SUCCESSFUL
105           projects:
106             - name: '{project-name}-build'
107               current-parameters: true
108               node-parameters: true
109               abort-all-job: false
110               kill-phase-on: FAILURE
111               property-file: $WORKSPACE/build.properties
112       - multijob:
113           name: Package
114           condition: SUCCESSFUL
115           execution-type: SEQUENTIALLY
116           projects:
117             - name: '{project-name}-package-artifacts'
118               current-parameters: true
119               node-parameters: true
120               abort-all-job: false
121               kill-phase-on: FAILURE
122               property-file: $WORKSPACE/build.properties
123             - name: '{project-name}-package-images'
124               current-parameters: true
125               node-parameters: true
126               abort-all-job: false
127               kill-phase-on: FAILURE
128               property-file: $WORKSPACE/build.properties
129             - name: '{project-name}-package-repositories'
130               current-parameters: true
131               node-parameters: true
132               abort-all-job: false
133               kill-phase-on: FAILURE
134               property-file: $WORKSPACE/build.properties
135       - multijob:
136           name: Promote
137           condition: SUCCESSFUL
138           execution-type: PARALLEL
139           projects:
140             - name: '{project-name}-promote-artifacts'
141               current-parameters: true
142               node-parameters: true
143               abort-all-job: false
144               kill-phase-on: FAILURE
145               property-file: $WORKSPACE/build.properties
146             - name: '{project-name}-promote-images'
147               current-parameters: true
148               node-parameters: true
149               abort-all-job: false
150               kill-phase-on: FAILURE
151               property-file: $WORKSPACE/build.properties
152             - name: '{project-name}-promote-repositories'
153               current-parameters: true
154               node-parameters: true
155               abort-all-job: false
156               kill-phase-on: FAILURE
157               property-file: $WORKSPACE/build.properties
158     triggers:
159       - timed: "@midnight"
160       - gerrit:
161           server-name: 'Nordix Gerrit'
162           trigger-on:
163             - change-merged-event
164             - comment-added-contains-event:
165                 comment-contains-value: 'remerge'
166           projects:
167             - project-compare-type: 'PLAIN'
168               project-pattern: 'onap/sdc'
169               branches:
170                 - branch-compare-type: 'PLAIN'
171                   branch-pattern: '20.2'
172             - project-compare-type: 'PLAIN'
173               project-pattern: 'local/onap/uds/sdc-customization'
174               branches:
175                 - branch-compare-type: 'PLAIN'
176                   branch-pattern: 'master'
177
178     wrappers:
179       - openstack:
180           single-use: True
181
182
183 - job-template:
184     name: '{project-name}-build'
185     description: 'Job for building out uds repositories'
186     workspace: '{workspace}'
187     node: '{node}'
188
189     builders:
190       - 'maven-build-repositories'
191
192
193 - job-template:
194     name: '{project-name}-package-artifacts'
195     description: 'Job for archiving uds artifacts (.war, .jar files etc.)'
196     workspace: '{workspace}'
197     node: '{node}'
198
199     builders:
200       - 'collect-file-artifacts'
201
202
203 - job-template:
204     name: '{project-name}-package-images'
205     description: 'Job for archiving uds docker images'
206     workspace: '{workspace}'
207     node: '{node}'
208
209     builders:
210       - 'package-docker-images'
211
212
213 - job-template:
214     name: '{project-name}-package-repositories'
215     description: 'Job for archiving uds source repos (sdc, sdc-customization)'
216     workspace: '{workspace}'
217     node: '{node}'
218
219     builders:
220       - 'maven-clean-repositories'
221       - 'package-source-repositories'
222
223
224 - job-template:
225     name: '{project-name}-promote-artifacts'
226     description: 'Job for pushing uds file artifacts (.war, .jar files etc.) to Artifactory'
227     workspace: '{workspace}'
228     node: '{node}'
229
230     builders:
231       - 'promote-file-artifacts-to-artifactory'
232     wrappers:
233       - 'artifactory-credentials'
234
235
236 - job-template:
237     name: '{project-name}-promote-images'
238     description: 'Job for pushing uds docker images to Artifactory'
239     workspace: '{workspace}'
240     node: '{node}'
241
242     builders:
243       - 'promote-docker-images-to-artifactory'
244     wrappers:
245       - 'artifactory-credentials'
246
247
248 - job-template:
249     name: '{project-name}-promote-repositories'
250     description: 'Job for pushing uds source repositories (sdc, sdc-customization) to Artifactory'
251     workspace: '{workspace}'
252     node: '{node}'
253
254     builders:
255       - 'promote-source-repositories-to-artifactory'
256     wrappers:
257       - 'artifactory-credentials'