758aa9327de67bbc8758c4c5de7114fb2dfef299
[infra/cicd.git] / jjb / infra / packer_build_jobs.yaml
1 ---
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2021 Nordix Foundation.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19 - project:
20
21     name: jenkins-slave-update-job
22
23     project: infra/tools
24
25     stream:
26       - master:
27           branch: '{stream}'
28
29     target:
30       - 'cloud-infra':
31            image: 'cloud-infra-base-ubuntu1804'
32            openstack-project: 'CICD'
33            region: 'fra'
34       - 'nordix-nsm-build-server':
35            image: 'nordix-nsm-build-ubuntu1804'
36            openstack-project: 'CICD'
37            region: 'fra'
38       - 'uds-build-server':
39            image: 'onap-uds-build-ubuntu1804'
40            openstack-project: 'CICD'
41            region: 'fra'
42       - 'nordix-onap-jenkins-build-server':
43            image: 'onap-build-ubuntu1804'
44            openstack-project: 'DefaultProject34201'
45            region: 'kna'
46       - 'oransc-build-server':
47            image: 'oransc-build-ubuntu2004'
48            openstack-project: 'DefaultProject34201'
49            region: 'kna'
50       - 'geode-build-server1804':
51            image: 'geode-build-ubuntu1804'
52            openstack-project: 'DefaultProject34201'
53            region: 'kna'
54       - 'geode-build-server2004':
55            image: 'geode-build-ubuntu2004'
56            openstack-project: 'DefaultProject34201'
57            region: 'kna'
58       - 'infra-build-ubuntu2004':
59            image: 'infra-build-ubuntu2004'
60            openstack-project: 'DefaultProject34201'
61            region: 'kna'
62
63     jobs:
64       - jenkins-slave-update-{target}-{stream}
65
66 - job-template:
67     name: jenkins-slave-update-{target}-{stream}
68
69     node: packer-ubuntu1804
70
71     disabled: false
72
73     concurrent: false
74
75     parameters:
76       - project-parameters:
77           project: '{project}'
78           branch: '{branch}'
79       - nordix-gerrit-parameters
80       - string:
81           name: PACKER_VERSION
82           default: '1.6.0'
83           description: 'Packer version.'
84       - string:
85           name: TARGET
86           default: '{target}'
87           description: 'Target project name.'
88       - string:
89           name: IMAGE
90           default: '{image}'
91           description: 'Image name to build.'
92
93     properties:
94       - logrotate
95
96     scm:
97       - git-scm:
98           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
99           branch: '{branch}'
100           refspec: ''
101           wipe_workspace: true
102           clean_before: false
103
104     triggers:
105       - nordix-gerrit-trigger-change-merged:
106           project: '{project}'
107           branch: '{branch}'
108           files: 'infra/jenkins/slave-setup/{target}/**'
109
110     wrappers:
111       - build-timeout:
112           timeout: 150
113       - fix-workspace-permissions
114       - mask-passwords
115       - openstack:
116           single-use: true
117       - credentials-binding:
118           - file:
119               credential-id: '{openstack-project}-openrc-{region}'
120               variable: OPENRC_FILE
121
122     builders:
123       - shell: |
124           #!/bin/bash
125           /bin/rm -f /tmp/openrc
126           /bin/cp -f $OPENRC_FILE /tmp/openrc
127       - shell:
128           !include-raw-escape: ./update-jenkins-slave.sh
129       - shell: |
130           #!/bin/bash
131           /bin/rm -f /tmp/openrc