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