blob: 23dc2563d525e237b5a2fa1054c1086e7051f7aa [file] [log] [blame]
Tomáš Kukrál7db4e5f2017-01-13 11:58:34 +01001/**
2 *
3 * Launch heat stack with basic k8s
4 *
5 * Expected parameters:
6 * HEAT_TEMPLATE_URL URL to git repo with Heat templates
7 * HEAT_TEMPLATE_CREDENTIALS Credentials to the Heat templates repo
8 * HEAT_TEMPLATE_BRANCH Heat templates repo branch
9 * OPENSTACK_API_URL OpenStack API address
10 * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
11 * OPENSTACK_API_PROJECT OpenStack project to connect to
12 * OPENSTACK_API_CLIENT Versions of OpenStack python clients
13 * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
14 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
15 * HEAT_STACK_NAME Heat stack name
16 * HEAT_STACK_TEMPLATE Heat stack HOT template
17 * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
18 * HEAT_STACK_ZONE Heat stack availability zone
19 * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
20 */
21
22git = new com.mirantis.mk.git()
23openstack = new com.mirantis.mk.openstack()
24salt = new com.mirantis.mk.salt()
25
26node {
27
28 // connection objects
29 def openstackCloud
30 def saltMaster
31
32 // value defaults
33 def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : "liberty"
34 def openstackEnv = "${env.WORKSPACE}/venv"
35
36 //stage ('Download Heat templates') {
37 // git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
38 //}
39
40 stage('Install OpenStack env') {
41 openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
42 }
43
44 stage('Connect to OpenStack cloud') {
45 openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
46 openstack.getKeystoneToken(openstackCloud, openstackEnv)
47 }
48
49 stage('Delete Heat stack') {
50 openstack.deleteHeatStack(openstackCloud, HEAT_STACK_NAME, openstackEnv)
51 }
52
53}