Commit 0274cef6 authored by ismail's avatar ismail

CI: updated the bracket testing with logs, html report

Signed-off-by: default avatarismail <mohammed.ismail@openairinterface.org>
parent 6189c46c
...@@ -46,6 +46,7 @@ def dsT_host_ip_addr = "" ...@@ -46,6 +46,7 @@ def dsT_host_ip_addr = ""
// Flags // Flags
def scmEvent = false def scmEvent = false
def upstreamEvent = false def upstreamEvent = false
def deployed = true
// Default tag --> could be passed on by upstream job or by PR content // Default tag --> could be passed on by upstream job or by PR content
def amfTag = params.amfTag def amfTag = params.amfTag
...@@ -173,7 +174,7 @@ pipeline { ...@@ -173,7 +174,7 @@ pipeline {
} }
// Do docker logs to recover the configuration results // Do docker logs to recover the configuration results
try { try {
sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-oai-amf >> archives/amf_config.log' sh 'docker inspect --format=\'STATUS: {{.State.Health.Status}}\' cicd-oai-amf > archives/amf_config.log'
} catch (Exception e) { } catch (Exception e) {
sh 'echo "STATUS: KO" >> archives/amf_config.log' sh 'echo "STATUS: KO" >> archives/amf_config.log'
} }
...@@ -188,6 +189,7 @@ pipeline { ...@@ -188,6 +189,7 @@ pipeline {
unsuccessful { unsuccessful {
script { script {
sh 'echo "DEPLOYMENT: KO" > archives/deployment_status.log' sh 'echo "DEPLOYMENT: KO" > archives/deployment_status.log'
deployed = false
} }
} }
} }
...@@ -252,11 +254,27 @@ pipeline { ...@@ -252,11 +254,27 @@ pipeline {
post { post {
always { always {
script { script {
// Get logs if deployment fails
if (deployed != true) {
sh 'mkdir -p archives/logs'
sh 'docker logs cicd-oai-amf > archives/logs/oai_amf.log'
}
// Remove any leftover containers/networks // Remove any leftover containers/networks
sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host sh 'python3 ./ci-scripts/routeCheck.py --mode=Delete --userName=' + dsT_host_user + ' --hostName=' + dsT_host
dir('ci-scripts/dsTesterDockerCompose') { dir('ci-scripts/dsTesterDockerCompose') {
sh 'docker-compose down > ../../archives/compose_l_down.log 2>&1' sh 'docker-compose down > ../../archives/compose_l_down.log 2>&1'
} }
// Generating the HTML report
sh 'python3 ./ci-scripts/bracketTestHTMLReport.py --job_name=' + JOB_NAME + ' --job_id=' + BUILD_ID + ' --job_url=' + BUILD_URL
// Zipping all archived log files
sh "zip -r -qq cn5g_amf_docker_logs.zip archives DS-TEST-RESULTS"
if (fileExists('cn5g_amf_docker_logs.zip')) {
archiveArtifacts artifacts: 'cn5g_amf_docker_logs.zip'
}
if (fileExists('test_results_oai_amf_bt.html')) {
archiveArtifacts artifacts: 'test_results_oai_amf_bt.html'
}
} }
} }
} }
......
...@@ -337,6 +337,35 @@ pipeline { ...@@ -337,6 +337,35 @@ pipeline {
} }
} }
} }
stage ('Bracket Testing with DsTester') {
steps {
script {
gitlabCommitStatus(name: "Bracket Test with DsTester") {
localStatus = build job: params.AMF_BT_PipelineName,
parameters: [
string(name: 'AMF_TAG', value: String.valueOf(amf_tag))
], propagate: false
localResult = localStatus.getResult()
if (localStatus.resultIsBetterOrEqualTo('SUCCESS')) {
echo "Bracket Test Job is OK"
} else {
echo "Bracket Test Job is KO"
sh "ci-scripts/fail.sh"
}
}
}
}
post {
always {
script {
copyArtifacts(projectName: params.AMF_BT_PipelineName,
filter: '*_results_oai_amf_bt.html',
selector: lastCompleted())
}
}
}
}
stage ('Testing in CN-5G-FED environment') { stage ('Testing in CN-5G-FED environment') {
steps { steps {
script { script {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment