Create jobs to handle and delete nolabs bookings
[infra/cicd.git] / jjb / nolabs / nolabs-booking-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 #--------------------------------------------------------------------------------------
22 # The jobs declared in this JJB configuration file are used for verifying patches
23 # that are sent to the repositories below
24 #   - cloud-infra/engine
25 #
26 # These jobs verify changes that
27 #   - implement new features or fix bugs for the deployment framework, engine, itself
28 #   - implement new features or fix bugs to the playbooks and roles used for utilizing
29 #     open source components such as bifrost, kubespray, and kolla-ansible
30 #   - bump versions of open source components or the scenarios
31 #
32 # These jobs are set to run on slaves with label vpod-deploy-ubuntu1604.
33 # The slaves have
34 #   - Ubuntu1604 as the base distro
35 #   - nested virtualization
36 #   - internet access
37 #   - passwordless sudo
38 #   - 16 CPUs/32GB RAM/200 GB Disk
39 #   - docker, git vim curl wget zip unzip chrony apt-transport-https ca-certificates curl
40 #     gnupg-agent software-properties-common docker-ce docker-ce-cli containerd.io openjdk-8-jre
41 #
42 # The slaves should not have a cloud infra scenario deployed on them.
43 #--------------------------------------------------------------------------------------
44
45 - project:
46     name: 'nolabs-booking'
47
48     project: 'infra/engine'
49
50     stream:
51       - 'master':
52           branch: '{stream}'
53           slave-label: 'vpod-deploy-ubuntu1804'
54           build-timeout: 60
55
56     booking-phase:
57       - 'handle'
58       - 'delete'
59
60     target-site:
61       - 'test':
62           api-users-endpoint: 'http://188.212.108.245/api/users'
63           api-bookings-endpoint: 'http://188.212.108.245/api/bookings'
64       - 'production':
65           api-users-endpoint: 'https://labs.nordix.org/api/users'
66           api-bookings-endpoint: 'https://labs.nordix.org/api/bookings'
67
68     jobs:
69       - 'nolabs-{booking-phase}-booking-{target-site}site-{stream}'
70
71 - job-template:
72     name: 'nolabs-{booking-phase}-booking-{target-site}site-{stream}'
73
74     disabled: '{obj:disabled}'
75
76     concurrent: true
77
78     parameters:
79       - project-parameters:
80           project: '{project}'
81           branch: '{branch}'
82       - nordix-gerrit-parameters
83       - label:
84           name: TARGET_SITE
85           default: '{target-site}'
86           description: 'Target site to handle the bookings for.'
87       - label:
88           name: SLAVE_LABEL
89           default: '{slave-label}'
90           description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use.'
91       - string:
92           name: BOOKING_PHASE
93           default: '{booking-phase}'
94           description: 'Phase of the booking.'
95       - string:
96           name: BOOKING_ID
97           default: 0
98           description: 'ID of the booking to handle. Default is 0 which is a non-existent booking to prevent running the job by mistake.'
99       - string:
100           name: DEPLOY_SCENARIO
101           default: 'k8-mycoolplugin-mycoolfeature'
102           description: 'Scenario to deploy for the booking. Default is a non-existent scenario to prevent running the job by mistake.'
103       - string:
104           name: NOLABS_API_USERS_ENDPOINT
105           default: '{api-users-endpoint}'
106           description: 'API endpoint for users.'
107       - string:
108           name: NOLABS_API_BOOKINGS_ENDPOINT
109           default: '{api-bookings-endpoint}'
110           description: 'API endpoint for bookings.'
111       - string:
112           name: NOLABS_USER_SSHPUBKEY
113           default: '/tmp/nolabs/id_rsa.pub'
114           description: 'SSH public key for the user who created the booking.'
115       - string:
116           name: NOLABS_VENV
117           default: '/tmp/nolabs/.venv'
118           description: 'Python virtualenv location to use.'
119       - string:
120           name: GERRIT_REFSPEC
121           default: 'refs/changes/79/2079/8'
122           description: 'Refspec to checkout'
123       - string:
124           name: HEAT_ENVIRONMENT_FILE
125           default: 'https://gerrit.nordix.org/gitweb?p=infra/engine.git;a=blob_plain;f=engine/provisioner/heat/playbooks/roles/install-configure-heat/files/heat-environment.yaml;h=401e1c4f547e9a2631e68d800cbcadef81b85641;hb=70df134c93b7ca3232ae723c3de98ad2b0299728'
126           description: 'Using a special heat environment file until the change gets merged.'
127
128     properties:
129       - logrotate
130       - build-blocker:
131           use-build-blocker: true
132           blocking-jobs:
133             - 'cloud-infra-verify-engine-.*'
134             - 'cloud-infra-verify-scenario-.*'
135             - 'cloud-infra-periodic-engine-.*'
136             - 'k8-.*'
137             - 'nolabs-.*'
138           block-level: 'NODE'
139       - throttle:
140           max-per-node: 1
141           max-total: 3
142           option: project
143
144     wrappers:
145       - credentials-binding:
146           - file:
147               credential-id: openrc-city-nolabs-default-nordix.sh
148               variable: OPENRC_FILE
149           - username-password-separated:
150               username: NOLABS_API_USERNAME
151               password: NOLABS_API_PASSWORD
152       - mask-passwords
153       - build-timeout:
154           timeout: '{build-timeout}'
155       - fix-workspace-permissions
156       - openstack:
157           single-use: True
158
159     scm:
160       - git-scm:
161           ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
162           branch: '{branch}'
163           refspec: ''
164           wipe_workspace: true
165           clean_before: false
166
167     builders:
168       - '{booking-phase}booking-macro'
169
170 # vim: set ts=2 sw=2 expandtab: