Skip to content

Commit

Permalink
added timestamps and email recipient
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulat Yusupov committed Jul 16, 2020
1 parent 9f653d4 commit 4108570
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,47 @@ pipeline {

agent any

// using the Timestamper plugin we can add timestamps to the console log
options {
timestamps()
}

environment {
//Use Pipeline Utility Steps plugin to read information from pom.xml into env variables
IMAGE = readMavenPom().getArtifactId()
VERSION = readMavenPom().getVersion()
EMAIL_RECIPIENTS = 'byusupov@provectus.com'
}

stages {
stage('Test') {
steps {
echo 'Test...'
}
}
}

post {
// Always runs. And it runs before any of the other post conditions.
always {
// Let's wipe out the workspace before we finish!
deleteDir()
}
success {
sendEmail("Successful");
}
unstable {
sendEmail("Unstable");
}
failure {
sendEmail("Failed");
}
}
}

def sendEmail(status) {
mail(
to: "$EMAIL_RECIPIENTS",
subject: "Build $BUILD_NUMBER - " + status + " (${currentBuild.fullDisplayName})",
body: "Changes:\n " + getChangeString() + "\n\n Check console output at: $BUILD_URL/console" + "\n")
}

0 comments on commit 4108570

Please sign in to comment.