added timestamps and email recipient
This commit is contained in:
parent
9f653d471c
commit
41085705bd
1 changed files with 36 additions and 0 deletions
36
Jenkinsfile
vendored
36
Jenkinsfile
vendored
|
@ -2,6 +2,18 @@ pipeline {
|
||||||
|
|
||||||
agent any
|
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 {
|
stages {
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
steps {
|
steps {
|
||||||
|
@ -9,4 +21,28 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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")
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue