Add swarm-run-test job
- add swarm-run-test job to run pytest tests
- workaround for timesync
- common groovy script for k8s and openstack deployments
Change-Id: Icfe13371fbed231bb4f5fd794d0a43edf347c06a
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
new file mode 100644
index 0000000..d44ce62
--- /dev/null
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -0,0 +1,56 @@
+@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
+
+node ("${NODE_NAME}") {
+ 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("Install core infrastructure and deploy CICD nodes") {
+ // steps: env.DRIVETRAIN_STACK_INSTALL
+ shared.swarm_deploy_cicd(env.DRIVETRAIN_STACK_INSTALL)
+ }
+
+ stage("Install core infrastructure and deploy CICD nodes") {
+ // steps: env.PLATFORM_STACK_INSTALL
+ shared.swarm_deploy_platform(env.PLATFORM_STACK_INSTALL)
+ }
+
+ stage("Run tests") {
+ shared.swarm_run_pytest(steps)
+ }
+
+ } catch (e) {
+ common.printMsg("Job failed", "red")
+ shared.run_cmd("""\
+ dos.py suspend ${ENV_NAME} || true
+ dos.py snapshot ${ENV_NAME} test_failed || true
+ """)
+ throw e
+ } finally {
+ // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'"
+ // and report appropriate data to TestRail
+ if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") {
+ shared.run_cmd("""\
+ dos.py resume ${ENV_NAME} || true
+ dos.py time-sync ${ENV_NAME} || true
+ """)
+ } else {
+ shared.run_cmd("""\
+ dos.py destroy ${ENV_NAME} || true
+ """)
+ }
+ shared.report_deploy_result(steps)
+ shared.report_test_result()
+ }
+}