cloud-infra: Pre-provisioned slaves and wait before using slave
[infra/cicd.git] / jjb / cloud-infra / cloud-infra-verify-jobs.yaml
1 ---
2 #
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2019 Nordix Foundation.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20
21 - project:
22     name: 'cloud-infra-verify'
23
24     project: 'infra/engine'
25
26     stream:
27       - 'master':
28           branch: '{stream}'
29           disabled: 'false'
30
31     distro:
32       - ubuntu1604
33
34     type:
35       - virtual
36
37     phase:
38       - deploy
39       - test
40
41     jobs:
42       - 'cloud-infra-verify-{distro}-{type}-{stream}'
43       - 'cloud-infra-verify-{distro}-{phase}-{type}-{stream}'
44
45 - job-template:
46     name: 'cloud-infra-verify-{distro}-{type}-{stream}'
47
48     project-type: multijob
49
50     disabled: '{obj:disabled}'
51
52     concurrent: true
53
54     parameters:
55       - project-parameters:
56           project: '{project}'
57           branch: '{branch}'
58       - nordix-gerrit-parameters
59       - label:
60           name: SLAVE_LABEL
61           default: 'cloud-infra-vpod'
62       - string:
63           name: DISTRO
64           default: '{distro}'
65       - string:
66           name: CLEANUP
67           default: 'true'
68
69     properties:
70       - logrotate
71       - build-blocker:
72           use-build-blocker: true
73           blocking-jobs:
74             - 'cloud-infra-verify-{distro}-.*'
75             - 'cloud-infra-os-.*'
76             - 'cloud-infra-k8-.*'
77           block-level: 'NODE'
78       - throttle:
79           max-per-node: 1
80           max-total: 3
81           option: project
82
83     wrappers:
84       - build-timeout:
85           timeout: 120
86       - fix-workspace-permissions
87       - openstack:
88           single-use: True
89
90     scm:
91       - git-scm-gerrit:
92           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
93           branch: '{branch}'
94           refspec: $GERRIT_REFSPEC
95
96     triggers:
97       - nordix-gerrit-trigger-patchset-created:
98           project: 'infra\/engine|infra\/swconfig'
99           branch: '{branch}'
100           files: '**'
101
102     builders:
103       - multijob:
104           name: deploy
105           condition: SUCCESSFUL
106           projects:
107             - name: 'cloud-infra-verify-{distro}-deploy-{type}-{stream}'
108               current-parameters: true
109               predefined-parameters: |
110                 DISTRO={distro}
111                 CLEANUP=$CLEANUP
112                 GERRIT_PROJECT=$GERRIT_PROJECT
113                 GERRIT_BRANCH=$GERRIT_BRANCH
114                 GERRIT_REFSPEC=$GERRIT_REFSPEC
115                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
116                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
117               node-parameters: true
118               kill-phase-on: FAILURE
119               abort-all-job: true
120       - multijob:
121           name: test
122           condition: SUCCESSFUL
123           projects:
124             - name: 'cloud-infra-verify-{distro}-test-{type}-{stream}'
125               current-parameters: true
126               predefined-parameters: |
127                 DISTRO={distro}
128                 CLEANUP=$CLEANUP
129                 GERRIT_PROJECT=$GERRIT_PROJECT
130                 GERRIT_BRANCH=$GERRIT_BRANCH
131                 GERRIT_REFSPEC=$GERRIT_REFSPEC
132                 GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
133                 GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
134               node-parameters: true
135               kill-phase-on: test
136               abort-all-job: true
137
138 - job-template:
139     name: 'cloud-infra-verify-{distro}-{phase}-{type}-{stream}'
140
141     disabled: false
142
143     concurrent: true
144
145     properties:
146       - logrotate
147
148     parameters:
149       - string:
150           name: PROJECT
151           default: $GERRIT_PROJECT
152       - string:
153           name: DISTRO
154           default: 'ubuntu1604'
155       - string:
156           name: CLEANUP
157           default: 'false'
158
159     wrappers:
160       - build-timeout:
161           timeout: 120
162       - fix-workspace-permissions
163
164     scm:
165       - git-scm-gerrit:
166           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
167           branch: '{branch}'
168           refspec: $GERRIT_REFSPEC
169
170     builders:
171       - 'cloud-infra-verify-{phase}-macro'
172
173 # -------------------------------
174 # builder macros
175 # -------------------------------
176
177 - builder:
178     name: 'cloud-infra-verify-deploy-macro'
179     builders:
180       - shell: |
181           #!/bin/bash
182
183           # it takes some time before the OpenStack slave becomes fully operational
184           # so we give it some more time before doing anything
185           sleep 30
186       - shell:
187           !include-raw: ./cloud-infra-deploy.sh
188
189 - builder:
190     name: 'cloud-infra-verify-test-macro'
191     builders:
192       - shell:
193           !include-raw: ./cloud-infra-test.sh
194
195 # vim: set ts=2 sw=2 expandtab: