add mk-k8s-cleanup pipeline
Change-Id: I597553f69ed3ca22c628e46b394f23ac52313957
diff --git a/mk-k8s-cleanup-pipeline.groovy b/mk-k8s-cleanup-pipeline.groovy
new file mode 100644
index 0000000..23dc256
--- /dev/null
+++ b/mk-k8s-cleanup-pipeline.groovy
@@ -0,0 +1,53 @@
+/**
+ *
+ * Launch heat stack with basic k8s
+ *
+ * Expected parameters:
+ * HEAT_TEMPLATE_URL URL to git repo with Heat templates
+ * HEAT_TEMPLATE_CREDENTIALS Credentials to the Heat templates repo
+ * HEAT_TEMPLATE_BRANCH Heat templates repo branch
+ * OPENSTACK_API_URL OpenStack API address
+ * OPENSTACK_API_CREDENTIALS Credentials to the OpenStack API
+ * OPENSTACK_API_PROJECT OpenStack project to connect to
+ * OPENSTACK_API_CLIENT Versions of OpenStack python clients
+ * OPENSTACK_API_VERSION Version of the OpenStack API (2/3)
+ * SALT_MASTER_CREDENTIALS Credentials to the Salt API
+ * HEAT_STACK_NAME Heat stack name
+ * HEAT_STACK_TEMPLATE Heat stack HOT template
+ * HEAT_STACK_ENVIRONMENT Heat stack environmental parameters
+ * HEAT_STACK_ZONE Heat stack availability zone
+ * HEAT_STACK_PUBLIC_NET Heat stack floating IP pool
+ */
+
+git = new com.mirantis.mk.git()
+openstack = new com.mirantis.mk.openstack()
+salt = new com.mirantis.mk.salt()
+
+node {
+
+ // connection objects
+ def openstackCloud
+ def saltMaster
+
+ // value defaults
+ def openstackVersion = OPENSTACK_API_CLIENT ? OPENSTACK_API_CLIENT : "liberty"
+ def openstackEnv = "${env.WORKSPACE}/venv"
+
+ //stage ('Download Heat templates') {
+ // git.checkoutGitRepository('template', HEAT_TEMPLATE_URL, HEAT_TEMPLATE_BRANCH, HEAT_TEMPLATE_CREDENTIALS)
+ //}
+
+ stage('Install OpenStack env') {
+ openstack.setupOpenstackVirtualenv(openstackEnv, openstackVersion)
+ }
+
+ stage('Connect to OpenStack cloud') {
+ openstackCloud = openstack.createOpenstackEnv(OPENSTACK_API_URL, OPENSTACK_API_CREDENTIALS, OPENSTACK_API_PROJECT)
+ openstack.getKeystoneToken(openstackCloud, openstackEnv)
+ }
+
+ stage('Delete Heat stack') {
+ openstack.deleteHeatStack(openstackCloud, HEAT_STACK_NAME, openstackEnv)
+ }
+
+}