Add small cloud with Ironic

Change-Id: Ibd099366cb1c8de045e37bc299eaf6a7e932df7c
diff --git a/jobs/pipelines/deploy-without-drivetrain-and-run-tests.groovy b/jobs/pipelines/deploy-without-drivetrain-and-run-tests.groovy
new file mode 100644
index 0000000..96ddf76
--- /dev/null
+++ b/jobs/pipelines/deploy-without-drivetrain-and-run-tests.groovy
@@ -0,0 +1,105 @@
+@Library('tcp-qa')_
+
+def common = new com.mirantis.mk.Common()
+def shared = new com.mirantis.system_qa.SharedPipeline()
+def steps = "hardware,create_model,salt," + env.DRIVETRAIN_STACK_INSTALL + "," + env.PLATFORM_STACK_INSTALL
+
+currentBuild.description = "${NODE_NAME}:${ENV_NAME}"
+
+def deploy(shared, common, steps) {
+    def report_text = ''
+    try {
+
+        stage("Clean the environment and clone tcp-qa") {
+            shared.prepare_working_dir()
+        }
+
+        stage("Create environment, generate model, bootstrap the salt-cluster") {
+            // steps: "hardware,create_model,salt"
+            shared.swarm_bootstrap_salt_cluster_devops()
+        }
+
+        stage("Deploy platform components from day01 Jenkins") {
+            // steps: env.PLATFORM_STACK_INSTALL
+            shared.swarm_deploy_platform_non_cicd(env.PLATFORM_STACK_INSTALL, env.PLATFORM_STACK_INSTALL_TIMEOUT)
+        }
+
+        currentBuild.result = 'SUCCESS'
+
+    } catch (e) {
+        common.printMsg("Deploy is failed: " + e.message , "purple")
+        report_text = e.message
+        def snapshot_name = "deploy_failed"
+        shared.run_cmd("""\
+            dos.py suspend ${ENV_NAME} || true
+            dos.py snapshot ${ENV_NAME} ${snapshot_name} || true
+        """)
+        if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") {
+            shared.run_cmd("""\
+                dos.py resume ${ENV_NAME} || true
+            """)
+        }
+        shared.devops_snapshot_info(snapshot_name)
+        throw e
+    } finally {
+        shared.create_deploy_result_report(steps, currentBuild.result, report_text)
+    }
+}
+
+def test(shared, common, steps) {
+    try {
+        stage("Run tests") {
+            shared.swarm_run_pytest(steps)
+        }
+
+    } catch (e) {
+        common.printMsg("Tests are failed: " + e.message, "purple")
+        def snapshot_name = "tests_failed"
+        shared.run_cmd("""\
+            dos.py suspend ${ENV_NAME} || true
+            dos.py snapshot ${ENV_NAME} ${snapshot_name} || true
+        """)
+        if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") {
+            shared.run_cmd("""\
+                dos.py resume ${ENV_NAME} || true
+            """)
+        }
+        shared.devops_snapshot_info(snapshot_name)
+        throw e
+    }
+}
+
+// main
+// Temporary disable throttle to check how it will run
+//throttle(['fuel_devops_environment']) {
+  node ("${NODE_NAME}") {
+    try {
+        // run deploy stages
+        deploy(shared, common, steps)
+        // run test stages
+        test(shared, common, steps)
+    } catch (e) {
+        common.printMsg("Job is failed: " + e.message, "purple")
+        throw e
+    } finally {
+        // shutdown the environment if required
+        if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "true") {
+            shared.run_cmd("""\
+                dos.py destroy ${ENV_NAME} || true
+            """)
+        }
+
+        stage("Archive all xml reports") {
+            archiveArtifacts artifacts: "**/*.xml,**/*.ini,**/*.log,**/*.tar.gz"
+        }
+        stage("report results to testrail") {
+            shared.swarm_testrail_report(steps)
+        }
+        stage("Store TestRail reports to job description") {
+            def String description = readFile("description.txt")
+            currentBuild.description += "\n${description}"
+        }
+
+    }
+  }
+//}
\ No newline at end of file
diff --git a/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy b/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy
new file mode 100644
index 0000000..8d3eb22
--- /dev/null
+++ b/jobs/pipelines/swarm-deploy-platform-without-cicd.groovy
@@ -0,0 +1,80 @@
+/**
+ *
+ * Deploy the product cluster using Jenkins master on CICD cluster
+ *
+ * Expected parameters:
+
+ *   PARENT_NODE_NAME              Name of the jenkins slave to create the environment
+ *   PARENT_WORKSPACE              Path to the workspace of the parent job to use tcp-qa repo
+ *   ENV_NAME                      Fuel-devops environment name
+ *   STACK_INSTALL                 Stacks to install using Jenkins on CICD cluster: "openstack,stacklight"
+ *   STACK_INSTALL_TIMEOUT         Stacks installation timeout
+ *   TCP_QA_REFS                   Reference to the tcp-qa change on review.gerrithub.io, like refs/changes/46/418546/41
+ *   SHUTDOWN_ENV_ON_TEARDOWN      optional, shutdown fuel-devops environment at the end of the job
+ *
+ */
+
+@Library('tcp-qa')_
+
+common = new com.mirantis.mk.Common()
+shared = new com.mirantis.system_qa.SharedPipeline()
+
+if (! env.PARENT_NODE_NAME) {
+    error "'PARENT_NODE_NAME' must be set from the parent deployment job!"
+}
+
+currentBuild.description = "${PARENT_NODE_NAME}:${ENV_NAME}"
+
+def install_timeout = env.STACK_INSTALL_TIMEOUT.toInteger()
+
+timeout(time: install_timeout + 600, unit: 'SECONDS') {
+
+    node ("${PARENT_NODE_NAME}") {
+        if (! fileExists("${PARENT_WORKSPACE}")) {
+            error "'PARENT_WORKSPACE' contains path to non-existing directory ${PARENT_WORKSPACE} on the node '${PARENT_NODE_NAME}'."
+        }
+        dir("${PARENT_WORKSPACE}") {
+
+            if (! env.STACK_INSTALL) {
+                error "'STACK_INSTALL' must contain one or more comma separated stack names for [deploy_openstack] pipeline"
+            }
+
+            if (env.TCP_QA_REFS) {
+                stage("Update working dir to patch ${TCP_QA_REFS}") {
+                    shared.update_working_dir()
+                }
+            }
+
+            try {
+                // Install the cluster
+                stage("Run Jenkins job on day01 [deploy_openstack:${env.STACK_INSTALL}]") {
+                    shared.run_job_on_day01_node(env.STACK_INSTALL, install_timeout)
+                }
+
+                for (stack in "${env.STACK_INSTALL}".split(",")) {
+                    stage("Sanity check the deployed component [${stack}]") {
+                        shared.sanity_check_component(stack)
+                    }
+                    stage("Make environment snapshot [${stack}_deployed]") {
+                        shared.devops_snapshot(stack)
+                    }
+                } // for
+
+            } catch (e) {
+                common.printMsg("Job is failed", "purple")
+                shared.download_logs("deploy_platform_${ENV_NAME}")
+                throw e
+            } finally {
+                // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'"
+                // and report appropriate data to TestRail
+                // TODO(ddmitriev): add checks for the installed stacks
+                if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "true") {
+                    shared.run_cmd("""\
+                        dos.py destroy ${ENV_NAME}
+                    """)
+                }
+            }
+
+        } // dir
+    } // node
+}
\ No newline at end of file