blob: 383444baff68302226a676228453f1a064679f1f [file] [log] [blame]
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01001/**
2 *
3 * Launch heat stack with basic k8s
4 * Flow parameters:
5 * STACK_TYPE Orchestration engine: heat, ''
6 * INSTALL What should be installed (k8s, openstack, ...)
Tomáš Kukrál55357d02017-02-28 22:56:45 +01007 * TEST What should be tested (k8s, openstack, ...)
Tomáš Kukrálb9957b32017-02-28 14:49:00 +01008 *
9 * Expected parameters:
10 *
11 * required for STACK_TYPE=heat
12 * HEAT_TEMPLATE_URL URL to git repo with Heat templates
13 * HEAT_TEMPLATE_CREDENTIALS Credentials to the Heat templates repo
14 * HEAT_TEMPLATE_BRANCH Heat templates repo branch
15 * HEAT_STACK_TEMPLATE Heat stack HOT template
16 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
17 * HEAT_STACK_ZONE Heat stack availability zone
18 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
19 * HEAT_STACK_DELETE Delete Heat stack when finished (bool)
20 * HEAT_STACK_CLEANUP_JOB Name of job for deleting Heat stack
21 * HEAT_STACK_REUSE Reuse Heat stack (don't create one)
22 * OPENSTACK_API_URL OpenStack API address
23 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
24 * OPENSTACK_API_PROJECT OpenStack project to connect to
25 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
26 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
27 *
28 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
29 *
30 * required for STACK_TYPE=NONE or empty string
31 * SALT_MASTER_URL URL of Salt-API
32
33 * K8S_API_SERVER Kubernetes API address
34 * K8S_CONFORMANCE_IMAGE Path to docker image with conformance e2e tests
35 *
36 */
37
38git = new com.mirantis.mk.Git()
39openstack = new com.mirantis.mk.Openstack()
40salt = new com.mirantis.mk.Salt()
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010041
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010042timestamps {
43 node {
Tomáš Kukrála18de112017-03-02 13:57:47 +010044 try {
45 //
46 // Prepare machines
47 //
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010048
Tomáš Kukrála18de112017-03-02 13:57:47 +010049 stage ('Create infrastructure') {
50 if (STACK_TYPE == 'heat') {
51 // value defaults
52 def openstackCloud
53 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : 'liberty'
54 def openstackEnv = "${env.WORKSPACE}/venv"
Tomáš Kukrálb9957b32017-02-28 14:49:00 +010055
Tomáš Kukrála18de112017-03-02 13:57:47 +010056 if (HEAT_STACK_NAME == '') {
57 HEAT_STACK_NAME = BUILD_TAG
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010058 }
Tomáš Kukrála18de112017-03-02 13:57:47 +010059
60 // get templates
61 git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
62
63 // create openstack env
64 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
65 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
66 openstack.getKeystoneToken(openstackCloud, openstackEnv)
67
68 // launch stack
69 if (HEAT_STACK_REUSE == 'false') {
70 stage('Launch new Heat stack') {
71 // create stack
72 envParams = [
73 'instance_zone': HEAT_STACK_ZONE,
74 'public_net': HEAT_STACK_PUBLIC_NET
75 ]
76 openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
77 }
78 }
79
80 // get SALT_MASTER_URL
81 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv)
82 SALT_MASTER_URL = "http://${saltMasterHost}:8088"
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010083 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010084 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010085
Tomáš Kukrála18de112017-03-02 13:57:47 +010086 //
87 // Connect to Salt master
88 //
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010089
Tomáš Kukrála18de112017-03-02 13:57:47 +010090 def saltMaster
91 stage('Connect to Salt API') {
92 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
93 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010094
Tomáš Kukrála18de112017-03-02 13:57:47 +010095 //
96 // Install
97 //
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +010098
Tomáš Kukrála18de112017-03-02 13:57:47 +010099 if (INSTALL.toLowerCase().contains('core')) {
100 stage('Install core infrastructure') {
101 // salt.master, reclass
102 // refresh_pillar
103 // sync_all
104 // linux,openssh,salt.minion.ntp
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100105
Tomáš Kukrála18de112017-03-02 13:57:47 +0100106 //orchestrate.installFoundationInfra(saltMaster)
107 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'state.sls', ['salt.master,reclass'])
Tomáš Kukrál97ab40b2017-03-02 11:55:55 +0100108 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar')
109 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all')
Tomáš Kukrála18de112017-03-02 13:57:47 +0100110 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'state.sls', ['linux,openssh,salt.minion,ntp'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100111
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100112
Tomáš Kukrála18de112017-03-02 13:57:47 +0100113 if (INSTALL.toLowerCase().contains('kvm')) {
114 //orchestrate.installInfraKvm(saltMaster)
115 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.refresh_pillar')
116 salt.runSaltProcessStep(saltMaster, 'I@linux:system', 'saltutil.sync_all')
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100117
Tomáš Kukrála18de112017-03-02 13:57:47 +0100118 salt.runSaltProcessStep(saltMaster, 'I@salt:control', 'state.sls', ['salt.minion,linux.system,linux.network,ntp'])
119 salt.enforceState(saltMaster, 'I@salt:control', 'libvirt', true)
120 salt.enforceState(saltMaster, 'I@salt:control', 'salt.control', true)
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100121
Tomáš Kukrála18de112017-03-02 13:57:47 +0100122 sleep(300)
123
124 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.refresh_pillar')
125 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'saltutil.sync_all')
126
127 // workaround - install apt-transport-https
128 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'pkg.install', ['apt-transport-https refresh=True'])
129 salt.runSaltProcessStep(saltMaster, '* and not kvm*', 'state.sls', ['linux,openssh,salt.minion,ntp'])
130 }
131
132 //orchestrate.validateFoundationInfra(saltMaster)
133 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['salt-key'])
134 salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'test.version')
135 salt.runSaltProcessStep(saltMaster, 'I@salt:master', 'cmd.run', ['reclass-salt --top'])
136 salt.runSaltProcessStep(saltMaster, 'I@reclass:storage', 'reclass.inventory')
137 salt.runSaltProcessStep(saltMaster, 'I@salt:minion', 'state.show_top')
138 }
139 }
140
141 // install k8s
142 if (INSTALL.toLowerCase().contains('k8s')) {
143 stage('Install Kubernetes infra') {
144 //orchestrate.installOpenstackMcpInfra(saltMaster)
145
146 // Comment nameserver
147 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'cmd.run', ["sed -i 's/nameserver 10.254.0.10/#nameserver 10.254.0.10/g' /etc/resolv.conf"])
148
149 // Install glusterfs
150 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.service'])
151
152 // Install keepalived
153 salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['keepalived'])
154 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'state.sls', ['keepalived'])
155
156 // Check the keepalived VIPs
157 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2'])
158
159 // Setup glusterfs
160 salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['glusterfs.server.setup'])
161 salt.runSaltProcessStep(saltMaster, 'ctl02*', 'state.sls', ['glusterfs.server.setup'])
162 salt.runSaltProcessStep(saltMaster, 'ctl03*', 'state.sls', ['glusterfs.server.setup'])
163 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'])
164 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'])
165
166 // Install haproxy
167 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'state.sls', ['haproxy'])
168 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy'])
169
170 // Install docker
171 salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'state.sls', ['docker.host'])
172 salt.runSaltProcessStep(saltMaster, 'I@docker:host', 'cmd.run', ['docker ps'])
173
174 // Install bird
175 salt.runSaltProcessStep(saltMaster, 'I@bird:server', 'state.sls', ['bird'])
176
177 // Install etcd
178 salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'state.sls', ['etcd.server.service'])
179 salt.runSaltProcessStep(saltMaster, 'I@etcd:server', 'cmd.run', ['etcdctl cluster-health'])
180
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100181 }
182
Tomáš Kukrála18de112017-03-02 13:57:47 +0100183 stage('Install Kubernetes control') {
184 //orchestrate.installOpenstackMcpControl(saltMaster)
Tomáš Kukrál06c27a92017-03-01 16:21:46 +0100185
Tomáš Kukrála18de112017-03-02 13:57:47 +0100186 // Install Kubernetes pool and Calico
187 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'state.sls', ['kubernetes.pool'])
188 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'cmd.run', ['calicoctl node status'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100189
Tomáš Kukrála18de112017-03-02 13:57:47 +0100190 // Setup etcd server
191 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['etcd.server.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100192
Tomáš Kukrála18de112017-03-02 13:57:47 +0100193 // Run k8s without master.setup
194 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'state.sls', ['kubernetes', 'exclude=kubernetes.master.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100195
Tomáš Kukrála18de112017-03-02 13:57:47 +0100196 // Run k8s master setup
197 salt.runSaltProcessStep(saltMaster, 'ctl01*', 'state.sls', ['kubernetes.master.setup'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100198
Tomáš Kukrála18de112017-03-02 13:57:47 +0100199 // Revert comment nameserver
200 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:master', 'cmd.run', ["sed -i 's/nameserver 10.254.0.10/#nameserver 10.254.0.10/g' /etc/resolv.conf"])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100201
Tomáš Kukrála18de112017-03-02 13:57:47 +0100202 // Set route
203 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'cmd.run', ['ip r a 10.254.0.0/16 dev ens4'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100204
Tomáš Kukrála18de112017-03-02 13:57:47 +0100205 // Restart kubelet
206 salt.runSaltProcessStep(saltMaster, 'I@kubernetes:pool', 'service.restart', ['kubelet'])
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100207 }
208
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100209 }
210
Tomáš Kukrála18de112017-03-02 13:57:47 +0100211 // install openstack
212 if (INSTALL.toLowerCase().contains('openstack')) {
213 // install Infra and control, tests, ...
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100214
Tomáš Kukrála18de112017-03-02 13:57:47 +0100215 stage('Install OpenStack infra') {
216 //orchestrate.installOpenstackMkInfra(saltMaster, physical)
217
218 // Install keepaliveds
219 //runSaltProcessStep(master, 'I@keepalived:cluster', 'state.sls', ['keepalived'], 1)
220 salt.enforceState(saltMaster, 'ctl01*', 'keepalived', true)
221 salt.enforceState(saltMaster, 'I@keepalived:cluster', 'keepalived', true)
222
223 // Check the keepalived VIPs
224 salt.runSaltProcessStep(saltMaster, 'I@keepalived:cluster', 'cmd.run', ['ip a | grep 172.16.10.2'])
225
226 // Install glusterfs
227 salt.enforceState(saltMaster, 'I@glusterfs:server', 'glusterfs.server.service', true)
228
229 //runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'state.sls', ['glusterfs.server.setup'], 1)
230 if (INSTALL.toLowerCase().contains('kvm')) {
Tomáš Kukrála18de112017-03-02 13:57:47 +0100231 salt.enforceState(saltMaster, 'kvm01*', 'glusterfs.server.setup', true)
232 salt.enforceState(saltMaster, 'kvm02*', 'glusterfs.server.setup', true)
233 salt.enforceState(saltMaster, 'kvm03*', 'glusterfs.server.setup', true)
Tomáš Kukrálbad54bb2017-03-02 15:46:20 +0100234 } else {
235 salt.enforceState(saltMaster, 'ctl01*', 'glusterfs.server.setup', true)
236 salt.enforceState(saltMaster, 'ctl02*', 'glusterfs.server.setup', true)
237 salt.enforceState(saltMaster, 'ctl03*', 'glusterfs.server.setup', true)
Tomáš Kukrála18de112017-03-02 13:57:47 +0100238 }
239
240 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster peer status'])
241 salt.runSaltProcessStep(saltMaster, 'I@glusterfs:server', 'cmd.run', ['gluster volume status'])
242
243 // Install rabbitmq
244 salt.enforceState(saltMaster, 'I@rabbitmq:server', 'rabbitmq', true)
245
246 // Check the rabbitmq status
247 salt.runSaltProcessStep(saltMaster, 'I@rabbitmq:server', 'cmd.run', ['rabbitmqctl cluster_status'])
248
249 // Install galera
250 salt.enforceState(saltMaster, 'I@galera:master', 'galera', true)
251 salt.enforceState(saltMaster, 'I@galera:slave', 'galera', true)
252
253 // Check galera status
254 salt.runSaltProcessStep(saltMaster, 'I@galera:master', 'mysql.status')
255 salt.runSaltProcessStep(saltMaster, 'I@galera:slave', 'mysql.status')
256
257 // Install haproxy
258 salt.enforceState(saltMaster, 'I@haproxy:proxy', 'haproxy', true)
259 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.status', ['haproxy'])
260 salt.runSaltProcessStep(saltMaster, 'I@haproxy:proxy', 'service.restart', ['rsyslog'])
261
262 // Install memcached
263 salt.enforceState(saltMaster, 'I@memcached:server', 'memcached', true)
264
Tomáš Kukrálc265e352017-03-02 11:45:11 +0100265 }
266
Tomáš Kukrála18de112017-03-02 13:57:47 +0100267 stage('Install OpenStack control') {
268 //orchestrate.installOpenstackMkControl(saltMaster)
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100269
Tomáš Kukrála18de112017-03-02 13:57:47 +0100270 // setup keystone service
271 //runSaltProcessStep(saltMaster, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
272 salt.enforceState(saltMaster, 'ctl01*', 'keystone.server', true)
273 salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
274 // populate keystone services/tenants/roles/users
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100275
Tomáš Kukrála18de112017-03-02 13:57:47 +0100276 // keystone:client must be called locally
277 salt.runSaltProcessStep(saltMaster, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'])
278 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; keystone service-list'])
279
280 // Install glance and ensure glusterfs clusters
281 //runSaltProcessStep(saltMaster, 'I@glance:server', 'state.sls', ['glance.server'], 1)
282 salt.enforceState(saltMaster, 'ctl01*', 'glance.server', true)
283 salt.enforceState(saltMaster, 'I@glance:server', 'glance.server', true)
284 salt.enforceState(saltMaster, 'I@glance:server', 'glusterfs.client', true)
285
286 // Update fernet tokens before doing request on keystone server
287 salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
288
289 // Check glance service
290 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'])
291
292 // Install and check nova service
293 //runSaltProcessStep(saltMaster, 'I@nova:controller', 'state.sls', ['nova'], 1)
294 salt.enforceState(saltMaster, 'ctl01*', 'nova', true)
295 salt.enforceState(saltMaster, 'I@nova:controller', 'nova', true)
296 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'])
297
298 // Install and check cinder service
299 //runSaltProcessStep(saltMaster, 'I@cinder:controller', 'state.sls', ['cinder'], 1)
300 salt.enforceState(saltMaster, 'ctl01*', 'cinder', true)
301 salt.enforceState(saltMaster, 'I@cinder:controller', 'cinder', true)
302 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'])
303
304 // Install neutron service
305 //runSaltProcessStep(saltMaster, 'I@neutron:server', 'state.sls', ['neutron'], 1)
306 salt.enforceState(saltMaster, 'ctl01*', 'neutron', true)
307 salt.enforceState(saltMaster, 'I@neutron:server', 'neutron', true)
308 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'])
309
310 // Install heat service
311 //runSaltProcessStep(saltMaster, 'I@heat:server', 'state.sls', ['heat'], 1)
312 salt.enforceState(saltMaster, 'ctl01*', 'heat', true)
313 salt.enforceState(saltMaster, 'I@heat:server', 'heat', true)
314 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'])
315
316 // Install horizon dashboard
317 salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true)
318 salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true)
319
320 }
321
322 stage('Install OpenStack network') {
323 //orchestrate.installOpenstackMkNetwork(saltMaster, physical)
324
325 // Install opencontrail database services
326 //runSaltProcessStep(saltMaster, 'I@opencontrail:database', 'state.sls', ['opencontrail.database'], 1)
327 salt.enforceState(saltMaster, 'ntw01*', 'opencontrail.database', true)
328 salt.enforceState(saltMaster, 'I@opencontrail:database', 'opencontrail.database', true)
329
330 // Install opencontrail control services
331 //runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'state.sls', ['opencontrail'], 1)
332 salt.enforceState(saltMaster, 'ntw01*', 'opencontrail', true)
333 salt.enforceState(saltMaster, 'I@opencontrail:control', 'opencontrail', true)
334
335 // Provision opencontrail control services
336 if (INSTALL.toLowerCase().contains('kvm')) {
337 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 172.16.10.254 --api_server_port 8082 --host_name ctl01 --host_ip 172.16.10.101 --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add'])
338 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 172.16.10.254 --api_server_port 8082 --host_name ctl02 --host_ip 172.16.10.102 --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add'])
339 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_control.py --api_server_ip 172.16.10.254 --api_server_port 8082 --host_name ctl03 --host_ip 172.16.10.103 --router_asn 64512 --admin_password workshop --admin_user admin --admin_tenant_name admin --oper add'])
340 }
341
342 // Test opencontrail
343 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control', 'cmd.run', ['contrail-status'])
344 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'])
345 salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'])
346 }
347
348 stage('Install OpenStack compute') {
349 //orchestrate.installOpenstackMkCompute(saltMaster, physical)
350 // Configure compute nodes
351 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply')
352 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply')
353
354 // Provision opencontrail virtual routers
355 if (INSTALL.toLowerCase().contains('kvm')) {
356 salt.runSaltProcessStep(saltMaster, 'I@opencontrail:control:id:1', 'cmd.run', ['/usr/share/contrail-utils/provision_vrouter.py --host_name cmp01 --host_ip 172.16.10.105 --api_server_ip 172.16.10.254 --oper add --admin_user admin --admin_password workshop --admin_tenant_name admin'])
357 }
358
359 salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'system.reboot')
360 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100361 }
362
Tomáš Kukrála18de112017-03-02 13:57:47 +0100363 //
364 // Test
365 //
366
367 if (TEST.toLowerCase().contains('k8s')) {
368 stage('Run k8s bootstrap tests') {
369 orchestrate.runConformanceTests(saltMaster, K8S_API_SERVER, 'tomkukral/k8s-scripts')
370 }
371
372 stage('Run k8s conformance e2e tests') {
373 orchestrate.runConformanceTests(saltMaster, K8S_API_SERVER, K8S_CONFORMANCE_IMAGE)
374 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100375 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100376
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100377
Tomáš Kukrála18de112017-03-02 13:57:47 +0100378 } catch (Throwable e) {
379 currentBuild.result = 'FAILURE'
380 throw e
Tomáš Kukrál65fb5fd2017-03-02 14:56:49 +0100381 } finally {
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100382
Tomáš Kukrála18de112017-03-02 13:57:47 +0100383 //
384 // Clean
385 //
386
387 if (HEAT_STACK_DELETE == 'true' && STACK_TYPE == 'heat') {
388 stage('Trigger cleanup job') {
389 build job: 'deploy_heat_cleanup', parameters: [[$class: 'StringParameterValue', name: 'HEAT_STACK_NAME', value: HEAT_STACK_NAME]]
390 }
Tomáš Kukrál9e0fb732017-03-02 10:12:05 +0100391 }
Tomáš Kukrálb9957b32017-02-28 14:49:00 +0100392 }
393 }
394}