dc1cb098619cbb0138ca6a5b4a402618cffc4181
[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-server':
51            image: 'geode-build-ubuntu2004'
52            openstack-project: 'DefaultProject34201'
53            region: 'kna'
54       - 'infra-build-ubuntu2004':
55            image: 'infra-build-ubuntu2004'
56            openstack-project: 'DefaultProject34201'
57            region: 'kna'
58
59     jobs:
60       - jenkins-slave-update-{target}-{stream}
61
62 - job-template:
63     name: jenkins-slave-update-{target}-{stream}
64
65     node: packer-ubuntu1804
66
67     disabled: false
68
69     concurrent: false
70
71     parameters:
72       - project-parameters:
73           project: '{project}'
74           branch: '{branch}'
75       - nordix-gerrit-parameters
76       - string:
77           name: PACKER_VERSION
78           default: '1.6.0'
79           description: 'Packer version.'
80       - string:
81           name: TARGET
82           default: '{target}'
83           description: 'Target project name.'
84       - string:
85           name: IMAGE
86           default: '{image}'
87           description: 'Image name to build.'
88
89     properties:
90       - logrotate
91
92     scm:
93       - git-scm:
94           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
95           branch: '{branch}'
96           refspec: ''
97           wipe_workspace: true
98           clean_before: false
99
100     triggers:
101       - nordix-gerrit-trigger-change-merged:
102           project: '{project}'
103           branch: '{branch}'
104           files: 'infra/jenkins/slave-setup/{target}/**'
105
106     wrappers:
107       - build-timeout:
108           timeout: 150
109       - fix-workspace-permissions
110       - mask-passwords
111       - openstack:
112           single-use: true
113       - credentials-binding:
114           - file:
115               credential-id: '{openstack-project}-openrc-{region}'
116               variable: OPENRC_FILE
117
118     builders:
119       - shell: |
120           #!/bin/bash
121           /bin/rm -f /tmp/openrc
122           /bin/cp -f $OPENRC_FILE /tmp/openrc
123       - shell:
124           !include-raw-escape: ./update-jenkins-slave.sh
125       - shell: |
126           #!/bin/bash
127           /bin/rm -f /tmp/openrc