| /** |
| * |
| * Deploy the product cluster using Jenkins master on CICD cluster |
| * |
| * Expected parameters: |
| |
| * ENV_NAME Fuel-devops environment name |
| * PASSED_STEPS Steps passed to install components using Jenkins on CICD cluster: "salt,core,cicd,openstack:3200,stacklight:2400", |
| where 3200 and 2400 might be timeouts (not used in the testing pipeline) |
| * RUN_TEST_OPTS Pytest option -k or -m, with expression to select necessary tests. Additional pytest options are allowed. |
| * 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 |
| * TCP_QA_REFS Reference to the tcp-qa change on Gerrit, like refs/changes/46/418546/41 |
| * SHUTDOWN_ENV_ON_TEARDOWN optional, shutdown fuel-devops environment at the end of the job |
| * TEMPEST_IMAGE_VERSION Tempest image version: pike by default, can be queens. |
| * TEMPEST_TARGET Node where tempest will be run |
| * MAKE_SNAPSHOT_STAGES optional, use "dos.py snapshot" to snapshot stages |
| */ |
| |
| @Library('tcp-qa')_ |
| |
| def common = new com.mirantis.mk.Common() |
| def shared = new com.mirantis.system_qa.SharedPipeline() |
| |
| def steps = env.PASSED_STEPS |
| def make_snapshot_stages = false |
| env.LAB_CONFIG_NAME = env.LAB_CONFIG_NAME ?: env.ENV_NAME |
| env.TEST_PLAN_NAME_PREFIX = '[2019.2.0-update]Upgraded' |
| |
| timeout(time: 23, unit: 'HOURS') { |
| 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}") { |
| env.slave_workdir = pwd() |
| if (env.TCP_QA_REFS) { |
| stage("Update working dir to patch ${TCP_QA_REFS}") { |
| shared.update_working_dir() |
| } |
| } |
| |
| stage("Run tests") { |
| try { |
| if (env.RUN_TEST_OPTS) { |
| shared.swarm_run_pytest(steps, "${PARENT_NODE_NAME}", make_snapshot_stages) |
| } else { |
| common.infoMsg("RUN_TEST_OPTS is empty, skipping 'swarm-run-pytest' job", "green") |
| } |
| } catch (e) { |
| common.infoMsg("Tests are failed: " + e.message, "purple") |
| currentBuild.result = 'FAILURE' |
| } |
| } // stage("Run tests") |
| if (fileExists("jenkins_agent_description.txt")) { |
| def String description = readFile("jenkins_agent_description.txt") |
| currentBuild.description = "${description}" |
| } |
| if (currentBuild.result != 'FAILURE') { |
| stage("Archive all xml reports") { |
| dir("${env.slave_workdir }") { |
| archiveArtifacts artifacts: "**/*.xml,**/*.log" |
| } |
| } |
| stage("report results to testrail from jenkins master") { |
| if ("${env.REPORT_TO_TESTRAIL}" != "false") { |
| common.infoMsg("Running on: " + env.PARENT_NODE_NAME, "blue") |
| shared.swarm_testrail_report(steps, env.PARENT_NODE_NAME) |
| } else { |
| common.infoMsg("REPORT_TO_TESTRAIL is set to FALSE. Skipped this step ") |
| } |
| } // stage("report results to testrail from jenkins master") |
| stage("Store TestRail reports to job description") { |
| if ("${env.REPORT_TO_TESTRAIL}" != "false") { |
| if (fileExists("description.txt")) { |
| def String description = readFile("description.txt") |
| currentBuild.description += "${description}" |
| } |
| } else { |
| common.infoMsg("REPORT_TO_TESTRAIL is set to FALSE. Skipped this step ") |
| println(currentBuild.result) |
| } |
| } // stage("Store TestRail reports to job description") |
| }//report if success |
| else{ |
| common.infoMsg("Upgrade status different from successful. Skipped report steps.") |
| println("Current result is " + currentBuild.result) |
| } |
| } // dir |
| } // node |
| } // timeout |