Fix cicd jobs
- use XML escape for '<' and '>' for all deployment reports
- revert the environment after pytest if
SHUTDOWN_ENV_ON_TEARDOWN=false
- change error messages color to 'purple' to differ from Groovy
traceback messages
- add helper message for reverting devops snapshots
Related task: PROD-21660
Change-Id: Ic2c5b0b69b647a0c6607cf45f6a60de1ec28ee6a
diff --git a/jobs/pipelines/swarm-run-pytest.groovy b/jobs/pipelines/swarm-run-pytest.groovy
index 5d7bd8d..0dd2d7a 100644
--- a/jobs/pipelines/swarm-run-pytest.groovy
+++ b/jobs/pipelines/swarm-run-pytest.groovy
@@ -69,13 +69,23 @@
py.test --junit-xml=nosetests.xml ${RUN_TEST_OPTS}
- dos.py suspend ${ENV_NAME}
- dos.py snapshot ${ENV_NAME} test_completed
""")
+
+ def snapshot_name = "test_completed"
+ shared.run_cmd("""\
+ dos.py suspend ${ENV_NAME}
+ dos.py snapshot ${ENV_NAME} ${snapshot_name}
+ """)
+ if ("${env.SHUTDOWN_ENV_ON_TEARDOWN}" == "false") {
+ shared.run_cmd("""\
+ dos.py resume ${ENV_NAME}
+ """)
+ }
+ shared.devops_snapshot_info(snapshot_name)
}
} catch (e) {
- common.printMsg("Job is failed", "red")
+ common.printMsg("Job is failed", "purple")
throw e
} finally {
// TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'"