blob: 924019eb5fbaf5a14eb614ce92679a75da44a096 [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
35 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : "liberty"
36 def openstackEnv = "${env.WORKSPACE}/venv"
Ales Komarek1b3870e2017-01-06 10:51:37 +010037
Jakub Josefa63f9862018-01-11 17:58:38 +010038 stage ('Download Heat templates') {
39 git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
40 }
41
42 stage('Install OpenStack env') {
43 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
44 }
45
46 stage('Connect to OpenStack cloud') {
47 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
48 openstack.getKeystoneToken(openstackCloud, openstackEnv)
49 }
50
51 stage('Launch new Heat stack') {
52 envParams = [
53 'availability_zone': HEAT_STACK_ZONE,
54 'public_net': HEAT_STACK_PUBLIC_NET
55 ]
56 openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
57 }
58
59 stage("Connect to Salt master") {
60 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv)
61 saltMasterUrl = "http://${saltMasterHost}:8000"
62 saltMaster = salt.createSaltConnection(saltMasterUrl, SALT_MASTER_CREDENTIALS)
63 }
64
65 stage("Install core infra") {
66 salt.installFoundationInfra(saltMaster)
67 salt.validateFoundationInfra(saltMaster)
68 }
69
70 //stage('Delete Heat stack') {
71 // openstack.deleteHeatStack(openstackCloud, HEAT_STACK_NAME, openstackEnv)
72 //}
Ales Komarek1b3870e2017-01-06 10:51:37 +010073 }
Ales Komarek1b3870e2017-01-06 10:51:37 +010074}