Tomáš Kukrál | fc13aa3 | 2017-02-28 23:20:04 +0100 | [diff] [blame^] | 1 | /** |
| 2 | * |
| 3 | * Launch heat stack with basic k8s |
| 4 | * |
| 5 | * Expected parameters: |
| 6 | * OPENSTACK_API_URL OpenStack API address |
| 7 | * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API |
| 8 | * OPENSTACK_API_PROJECT OpenStack project to connect to |
| 9 | * OPENSTACK_API_CLIENT Versions of OpenStack python clients |
| 10 | * OPENSTACK_API_VERSION Version of the OpenStack API (2/3) |
| 11 | * HEAT_STACK_NAME Heat stack name |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | git = new com.mirantis.mk.Git() |
| 16 | openstack = new com.mirantis.mk.Openstack() |
| 17 | salt = new com.mirantis.mk.Salt() |
| 18 | |
| 19 | node { |
| 20 | |
| 21 | // connection objects |
| 22 | def openstackCloud |
| 23 | def saltMaster |
| 24 | |
| 25 | // value defaults |
| 26 | def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : 'liberty' |
| 27 | def openstackEnv = "${env.WORKSPACE}/venv" |
| 28 | |
| 29 | stage('Install OpenStack env') { |
| 30 | openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion) |
| 31 | } |
| 32 | |
| 33 | stage('Connect to OpenStack cloud') { |
| 34 | openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT) |
| 35 | openstack.getKeystoneToken(openstackCloud, openstackEnv) |
| 36 | } |
| 37 | |
| 38 | stage('Delete Heat stack') { |
| 39 | openstack.deleteHeatStack(openstackCloud, HEAT_STACK_NAME, openstackEnv) |
| 40 | } |
| 41 | |
| 42 | } |