From 62af910313258a101aafec3864b7daadb275b14e Mon Sep 17 00:00:00 2001 From: Sameera Priyatham Tadikonda Date: Thu, 23 Mar 2023 12:02:31 -0700 Subject: [PATCH] DEVO-766: Copying the logs from container --- Jenkinsfile | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e927c2291e..4c0642590d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -755,6 +755,22 @@ println("Core Unit Tests Completed") sendMail email,'

All the Core Unit Tests Passed on $BRANCH_NAME and the next stage is Code-review.

Check the Pipeline View

Check Console Output Here

',false,'Unit Tests for $BRANCH_NAME Passed' } } +void postCoreTestsUnstable(){ +println("Unit Tests Failed") + sh 'mkdir -p MLLogs;mkdir -p MLLogs/container1;docker cp ml1.marklogic:/var/opt/MarkLogic/Logs/ $WORKSPACE/MLLogs/container1/;mkdir -p MLLogs/container2;docker cp ml2.marklogic:/var/opt/MarkLogic/Logs/ $WORKSPACE/MLLogs/container2/;mkdir -p MLLogs/container3;docker cp ml3.marklogic:/var/opt/MarkLogic/Logs/ $WORKSPACE/MLLogs/container3/;' + archiveArtifacts artifacts: 'MLLogs/**/*' + script{ + def email; + if(env.CHANGE_AUTHOR){ + def author=env.CHANGE_AUTHOR.toString().trim().toLowerCase() + email=getEmailFromGITUser author + }else{ + email=Email + } + sendMail email,'

Some of the Core Unit Tests Failed on $BRANCH_NAME. Please look into the issues and fix it.

Check the Test Report

Check the Pipeline View

Check Console Output Here

',false,'Core Unit Tests for $BRANCH_NAME Failed' + } +} + void postTestsUnstable(){ println("Unit Tests Failed") @@ -768,7 +784,7 @@ println("Unit Tests Failed") }else{ email=Email } - sendMail email,'

Some of the Core Unit Tests Failed on $BRANCH_NAME. Please look into the issues and fix it.

Check the Test Report

Check the Pipeline View

Check Console Output Here

',false,'Unit Tests for $BRANCH_NAME Failed' + sendMail email,'

Some of the Unit Tests Failed on $BRANCH_NAME. Please look into the issues and fix it.

Check the Test Report

Check the Pipeline View

Check Console Output Here

',false,'Unit Tests for $BRANCH_NAME Failed' } } @@ -899,7 +915,7 @@ pipeline{ postTestsSuccess() } unstable { - postTestsUnstable() + postCoreTestsUnstable() } } } @@ -935,12 +951,12 @@ pipeline{ postStage('Tests Passed') } unstable { - sh 'rm -rf ${STAGE_NAME}|| true;mkdir -p ${STAGE_NAME}/MLLogs;cp -r /var/opt/MarkLogic/Logs/* $WORKSPACE/MLLogs/ || true; mkdir -p ${STAGE_NAME}/E2ELogs; cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/videos ${STAGE_NAME}/E2ELogs/;cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/screenshots ${STAGE_NAME}/E2ELogs/' + sh 'rm -rf ${STAGE_NAME}|| true;mkdir -p ${STAGE_NAME}/MLLogs;cp -r /var/opt/MarkLogic/Logs/* $WORKSPACE/${STAGE_NAME}/MLLogs/ || true; mkdir -p ${STAGE_NAME}/E2ELogs; cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/videos ${STAGE_NAME}/E2ELogs/;cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/screenshots ${STAGE_NAME}/E2ELogs/' archiveArtifacts artifacts: "**/E2ELogs/**/videos/**/*,**/E2ELogs/**/screenshots/**/*,${STAGE_NAME}/MLLogs/**/*" postStage('Tests Failed') } failure{ - sh 'rm -rf ${STAGE_NAME} || true;mkdir -p ${STAGE_NAME}/MLLogs;cp -r /var/opt/MarkLogic/Logs/* $WORKSPACE/MLLogs/ || true; mkdir -p ${STAGE_NAME}/E2ELogs; cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/videos ${STAGE_NAME}/E2ELogs/;cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/screenshots ${STAGE_NAME}/E2ELogs/' + sh 'rm -rf ${STAGE_NAME} || true;mkdir -p ${STAGE_NAME}/MLLogs;cp -r /var/opt/MarkLogic/Logs/* $WORKSPACE/${STAGE_NAME}/MLLogs/ || true; mkdir -p ${STAGE_NAME}/E2ELogs; cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/videos ${STAGE_NAME}/E2ELogs/;cp -r data-hub/marklogic-data-hub-central/ui/e2e/cypress/screenshots ${STAGE_NAME}/E2ELogs/' archiveArtifacts artifacts: "**/E2ELogs/**/videos/**/*,**/E2ELogs/**/screenshots/**/*,${STAGE_NAME}/MLLogs/**/*" postStage('Stage Failed') }}