blob: 4142cec7d00ee1e40694e315aa0ae6aa5da8c0d6 [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
27node {
28
29 // connection objects
30 def openstackCloud
31 def saltMaster
32
33 // value defaults
34 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : "liberty"
35 def openstackEnv = "${env.WORKSPACE}/venv"
36
37 stage ('Download Heat templates') {
38 git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
39 }
40
41 stage('Install OpenStack env') {
42 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
43 }
44
45 stage('Connect to OpenStack cloud') {
46 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
47 openstack.getKeystoneToken(openstackCloud, openstackEnv)
48 }
49
50 stage('Launch new Heat stack') {
51 envParams = [
52 'availability_zone': HEAT_STACK_ZONE,
53 'public_net': HEAT_STACK_PUBLIC_NET
54 ]
55 openstack.createHeatStack(openstackCloud, HEAT_STACK_NAME, HEAT_STACK_TEMPLATE, envParams, HEAT_STACK_ENVIRONMENT, openstackEnv)
56 }
57
58 stage("Connect to Salt master") {
59 saltMasterHost = openstack.getHeatStackOutputParam(openstackCloud, HEAT_STACK_NAME, 'salt_master_ip', openstackEnv)
60 saltMasterUrl = "http://${saltMasterHost}:8000"
61 saltMaster = salt.createSaltConnection(saltMasterUrl, SALT_MASTER_CREDENTIALS)
62 }
63
64 stage("Install core infra") {
65 salt.installFoundationInfra(saltMaster)
66 salt.validateFoundationInfra(saltMaster)
67 }
68
69 //stage('Delete Heat stack') {
70 // openstack.deleteHeatStack(openstackCloud, HEAT_STACK_NAME, openstackEnv)
71 //}
72
73}