I setup multi branch project on jenkins . this is my JenkinsFile:
properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '14', artifactNumToKeepStr: '10', daysToKeepStr: '14', numToKeepStr: '10']]])
node {
checkout scm
def lib = load 'cicd/shared-library.groovy'
stage('build project') {
lib.compileProject()
}
stage('Unit test') {
lib.executeUnitTest()
}
stage('Archive log files') {
def files = ["failure_services.txt", "unit_test.log"]
lib.archiveFile(files, "unit_test_result.tar.xz")
}
stage('send email') {
def subject = "Test Result"
def content = 'ًLog file attached'
def toList = ["aaa@gmail.com", "bbb@gmail.com"]
def ccList = ["xxx@gmail.com", "zzz@gmail.com"]
def attachmentFiles = ["unit_test_result.tar.xz"]
lib.sendMail(toList, ccList, subject, content, attachmentFiles)
}
cleanWs()
}
sometimes Unit test
stage result a error , so in this case next steps not executed .
I want send email
stage executed under any circumstances .
How can config that on JenkinsFile ?