Skip to content

Commit

Permalink
JenkinsFileCommit
Browse files Browse the repository at this point in the history
  • Loading branch information
MustafaAgamy committed Jan 1, 2024
1 parent 7edd2d6 commit 5e4e794
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,30 @@ pipeline {
}
}
}
}
post {
always {
stage('Mail Distribution') {
steps {
script {
echo "Starting 'Mail Distribution' Stage!!"
bat "C:/Users/Agami/scoop/apps/allure/2.25.0/bin/allure.bat generate --single-file allure-results --clean"
def allureAttachment = "${ALLURE_REPORT}"
def allureReportPath = "${ALLURE_REPORT}${ALLURE_REPORT_HTML}"
def testNGAttachment = "${TARGET_FOLDER}${SUREFIRE_REPORTS}${HTML_REPORT}"
def testNGReportContent = readFile(file: testNGAttachment)

stage('Mail Distribution') {
steps {
script {
echo "Starting 'Mail Distribution' Stage!!"
bat "C:/Users/Agami/scoop/apps/allure/2.25.0/bin/allure.bat generate --single-file allure-results --clean"
def allureAttachment = "${ALLURE_REPORT}"
def allureReportPath = "${ALLURE_REPORT}${ALLURE_REPORT_HTML}"
def testNGAttachment = "${TARGET_FOLDER}${SUREFIRE_REPORTS}${HTML_REPORT}"
def testNGReportContent = readFile(file: testNGAttachment)

if (fileExists(allureAttachment) || fileExists(testNGAttachment)) {
emailext(
subject: "Allure Results",
body: "Please find the attached test results. \n\n${testNGReportContent}",
to: "${EMAIL_RECIPIENT}",
mimeType: 'text/html',
attachmentsPattern: "${allureAttachment},${testNGAttachment}"
)
} else {
echo "File doesn't exist at: ${allureAttachment},${testNGAttachment}"
if (fileExists(allureAttachment) || fileExists(testNGAttachment)) {
emailext(
subject: "Allure Results",
body: "Please find the attached test results. \n\n${testNGReportContent}",
to: "${EMAIL_RECIPIENT}",
mimeType: 'text/html',
attachmentsPattern: "${allureAttachment},${testNGAttachment}"
)
} else {
echo "File doesn't exist at: ${allureAttachment},${testNGAttachment}"
}
}
}
}
Expand Down

0 comments on commit 5e4e794

Please sign in to comment.