blob: 9a2244e84acb05d48d7bfdcfe1f639ee5d8e8abe [file] [log] [blame]
Ales Komarek1b3870e2017-01-06 10:51:37 +01001/**
Tomáš Kukrál511be612017-02-20 14:50:18 +01002 * DO NOT USE THIS OUTDATED PIPELINE - add your steps to mk-lab-pipeline
Ales Komarek1b3870e2017-01-06 10:51:37 +01003 *
4 * Launch heat stack with MAAS lab
5 *
6 * Expected parameters:
7 * HEAT_TEMPLATE_URL URL to git repo with Heat templates
8 * HEAT_TEMPLATE_CREDENTIALS Credentials to the Heat templates repo
9 * HEAT_TEMPLATE_BRANCH Heat templates repo branch
10 * OPENSTACK_API_URL OpenStack API address
11 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
12 * OPENSTACK_API_PROJECT OpenStack project to connect to
13 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
14 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
15 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
16 * HEAT_STACK_NAME Heat stack name
17 * HEAT_STACK_TEMPLATE Heat stack HOT template
18 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
19 * HEAT_STACK_ZONE Heat stack availability zone
20 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
21 */
22
23git = new com.mirantis.mk.git()
24openstack = new com.mirantis.mk.openstack()
25salt = new com.mirantis.mk.salt()
26
Jakub Josefa63f9862018-01-11 17:58:38 +010027timeout(time: 12, unit: 'HOURS') {
28 node {
Ales Komarek1b3870e2017-01-06 10:51:37 +010029
Jakub Josefa63f9862018-01-11 17:58:38 +010030 // connection objects
31 def openstackCloud
32 def saltMaster
Ales Komarek1b3870e2017-01-06 10:51:37 +010033
Jakub Josefa63f9862018-01-11 17:58:38 +010034 // value defaults
Jakub Josef88aaf832018-01-18 16:18:28 +010035 def workspace = common.getWorkspace()
Jakub Josefa63f9862018-01-11 17:58:38 +010036 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : "liberty"
Jakub Josef88aaf832018-01-18 16:18:28 +010037 def openstackEnv = "${workspace}/venv"
Ales Komarek1b3870e2017-01-06 10:51:37 +010038
Jakub Josefa63f9862018-01-11 17:58:38 +010039 stage ('Download Heat templates') {
40 git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
41 }
42
43 stage('Install OpenStack env') {
44 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
45 }
46
47 stage('Connect to OpenStack cloud') {
Jakub Josef88aaf832018-01-18 16:18:28 +010048 openstackCloud = openstack.createOpenstackEnv(openstackEnv, OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
Jakub Josefa63f9862018-01-11 17:58:38 +010049 openstack.getKeystoneToken(openstackCloud, openstackEnv)
50 }
51
52 stage('Launch new Heat stack') {
53 envParams = [
54 'availability_zone': HEAT_STACK_ZONE,
55 'public_net': HEAT_STACK_PUBLIC_NET
56 ]
57 openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
58 }
59
60 stage("Connect to Salt master") {
61 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv)
62 saltMasterUrl = "http://${saltMasterHost}:8000"
63 saltMaster = salt.createSaltConnection(saltMasterUrl, SALT_MASTER_CREDENTIALS)
64 }
65
66 stage("Install core infra") {
67 salt.installFoundationInfra(saltMaster)
68 salt.validateFoundationInfra(saltMaster)
69 }
70
71 //stage('Delete Heat stack') {
72 // openstack.deleteHeatStack(openstackCloud, HEAT_STACK_NAME, openstackEnv)
73 //}
Ales Komarek1b3870e2017-01-06 10:51:37 +010074 }
Ales Komarek1b3870e2017-01-06 10:51:37 +010075}