Merge "Store artifacts from the remote Jenkins slave if present"
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index f9273e1..de92a25 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -13,7 +13,7 @@
make_snapshot_stages = false
}
-currentBuild.description = "${NODE_NAME}:${ENV_NAME}"
+currentBuild.description = "${NODE_NAME}:${ENV_NAME}<br>"
def deploy(shared, common, steps, env_manager) {
def report_text = ''
@@ -131,6 +131,21 @@
}
}
+ if (fileExists("jenkins_agent_description.txt")) {
+ def String jenkins_agent_description = readFile("jenkins_agent_description.txt")
+ currentBuild.description += "${jenkins_agent_description}"
+
+ // if there is a separated foundation node on $jenkins_slave_node_name,
+ // then archive artifacts also on that node
+ if (jenkins_slave_node_name != env.NODE_NAME) {
+ node ("${jenkins_slave_node_name}") {
+ stage("Archive all xml reports from node ${}") {
+ archiveArtifacts artifacts: "**/*.xml,**/*.ini,**/*.log,**/*.tar.gz"
+ }
+ }
+ }
+ }
+
stage("Archive all xml reports") {
archiveArtifacts artifacts: "**/*.xml,**/*.ini,**/*.log,**/*.tar.gz"
}
@@ -140,9 +155,11 @@
}
stage("Store TestRail reports to job description") {
def String description = readFile("description.txt")
- currentBuild.description += "\n${description}"
+ currentBuild.description += "${description}"
}
}
- }
- }
+ } // try
+ } // node
+
+
//}
\ No newline at end of file
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
index 392be7c..802a0a5 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-devops.groovy
@@ -70,6 +70,7 @@
export PYTHONIOENCODING=UTF-8
export REPOSITORY_SUITE=${MCP_VERSION}
export TEST_GROUP=test_create_environment
+ export LOG_NAME=swarm_test_create_environment.log
py.test -vvv -s -p no:django -p no:ipdb --junit-xml=deploy_hardware.xml -k \${TEST_GROUP}
""")
}
@@ -122,6 +123,7 @@
export PYTHONIOENCODING=UTF-8
export REPOSITORY_SUITE=${MCP_VERSION}
export TEST_GROUP=test_bootstrap_salt
+ export LOG_NAME=swarm_test_bootstrap_salt.log
py.test -vvv -s -p no:django -p no:ipdb --junit-xml=${xml_report_name} -k \${TEST_GROUP}
""")
// Wait for jenkins to start and IO calm down
diff --git a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
index cfb080f..8c10291 100644
--- a/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
+++ b/jobs/pipelines/swarm-bootstrap-salt-cluster-heat.groovy
@@ -97,7 +97,7 @@
}
stage("Generate config drive ISO") {
- def SALT_MASTER_IP=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py management_subnet_cfg01_ip").trim().split().last()
+ SALT_MASTER_IP=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py management_subnet_cfg01_ip").trim().split().last()
def ADMIN_NETWORK_GW=shared.run_cmd_stdout("./tcp_tests/utils/get_param_heat_template.py management_subnet_gateway_ip").trim().split().last()
shared.generate_configdrive_iso(SALT_MASTER_IP, ADMIN_NETWORK_GW)
}
@@ -157,6 +157,7 @@
export ENV_NAME=${ENV_NAME}
export LAB_CONFIG_NAME=${LAB_CONFIG_NAME}
export LAB_PARAM_DEFAULTS=${LAB_PARAM_DEFAULTS}
+ export LOG_NAME=swarm_test_create_environment.log
py.test --cache-clear -vvv -s -p no:django -p no:ipdb --junit-xml=deploy_hardware.xml -k \${TEST_GROUP}
""")
}
@@ -233,11 +234,16 @@
shared.verbose_sh(script_delete_agent, true, false, true)
shared.verbose_sh(script_create_agent, true, false, true)
+ // Store jenkins agent IP address
+ jenkins_agent_description = "ssh jenkins@${jenkins_slave_ip} # foundation node with Jenkins agent <a href=${JENKINS_URL}/computer/${JENKINS_SLAVE_NODE_NAME}>${JENKINS_SLAVE_NODE_NAME}</a><br>ssh root@${SALT_MASTER_IP} # cfg01 node<br>"
+ writeFile(file: "jenkins_agent_description.txt", text: jenkins_agent_description, encoding: "UTF-8")
+
} // withCredentials
}// stage
} // withCredentials
+
} // dir
} // node
@@ -278,6 +284,7 @@
export PYTHONIOENCODING=UTF-8
export REPOSITORY_SUITE=${MCP_VERSION}
export TEST_GROUP=test_bootstrap_salt
+ export LOG_NAME=swarm_test_bootstrap_salt.log
py.test -vvv -s -p no:django -p no:ipdb --junit-xml=${xml_report_name} -k \${TEST_GROUP}
""")
// Wait for jenkins to start and IO calm down
diff --git a/jobs/pipelines/swarm-run-pytest.groovy b/jobs/pipelines/swarm-run-pytest.groovy
index 1e4c849..d403861 100644
--- a/jobs/pipelines/swarm-run-pytest.groovy
+++ b/jobs/pipelines/swarm-run-pytest.groovy
@@ -73,6 +73,7 @@
export SALT_USER=\$SALTAPI_USER
export SALT_PASSWORD=\$SALTAPI_PASS
+ export LOG_NAME=swarm_run_pytest.log
py.test --junit-xml=nosetests.xml ${RUN_TEST_OPTS}
""")
diff --git a/jobs/pipelines/swarm-testrail-report.groovy b/jobs/pipelines/swarm-testrail-report.groovy
index 42be763..2d2f993 100644
--- a/jobs/pipelines/swarm-testrail-report.groovy
+++ b/jobs/pipelines/swarm-testrail-report.groovy
@@ -87,7 +87,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
@@ -108,7 +108,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
@@ -124,7 +124,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
@@ -150,7 +150,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
@@ -172,7 +172,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
@@ -188,7 +188,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
@@ -210,7 +210,7 @@
report_url = report_result.split("\n").each {
if (it.contains("[TestRun URL]")) {
common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
- description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+ description += "<a href=" + it.trim().split().last() + ">${testSuiteName}</a><br>"
}
}
}
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index ed667b8..d74b600 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -541,6 +541,7 @@
// Result will be stored in JUnit XML file deploy_${stack}.xml
try {
run_cmd("""\
+ export LOG_NAME=deploy_${stack}_test.log
py.test --junit-xml=deploy_${stack}.xml -m check_${stack}
""")
} catch (e) {
diff --git a/tcp_tests/logger.py b/tcp_tests/logger.py
index 2c73364..1d1c1f1 100644
--- a/tcp_tests/logger.py
+++ b/tcp_tests/logger.py
@@ -24,7 +24,8 @@
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(levelname)s %(filename)s:'
'%(lineno)d -- %(message)s',
- filename=os.path.join(settings.LOGS_DIR, 'tests.log'),
+ filename=os.path.join(settings.LOGS_DIR,
+ settings.LOG_NAME),
filemode='w')
console = logging.StreamHandler()
diff --git a/tcp_tests/settings.py b/tcp_tests/settings.py
index f98981d..e8968be 100644
--- a/tcp_tests/settings.py
+++ b/tcp_tests/settings.py
@@ -24,6 +24,7 @@
LOGS_DIR = os.environ.get('LOGS_DIR', os.getcwd())
+LOG_NAME = os.environ.get('LOG_NAME', 'tests.log')
TIMESTAT_PATH_YAML = os.environ.get(
'TIMESTAT_PATH_YAML', os.path.join(
LOGS_DIR, 'timestat_{}.yaml'.format(time.strftime("%Y%m%d"))))
diff --git a/tcp_tests/templates/heat-cicd-pike-contrail41-sl/underlay--user-data-foundation.yaml b/tcp_tests/templates/heat-cicd-pike-contrail41-sl/underlay--user-data-foundation.yaml
index cb551ef..1677dcd 100644
--- a/tcp_tests/templates/heat-cicd-pike-contrail41-sl/underlay--user-data-foundation.yaml
+++ b/tcp_tests/templates/heat-cicd-pike-contrail41-sl/underlay--user-data-foundation.yaml
@@ -15,6 +15,7 @@
chpasswd:
list: |
root:r00tme
+ jenkins:qalab
expire: False
packages: