Skip to content

Instantly share code, notes, and snippets.

@hagzag
Forked from nadavdaniellightapp/Jenkinsfile
Last active August 22, 2019 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagzag/4e026f049a0777add0a9d497e6c8fdcb to your computer and use it in GitHub Desktop.
Save hagzag/4e026f049a0777add0a9d497e6c8fdcb to your computer and use it in GitHub Desktop.
pipeline {
agent {
node {
label 'collectors-slave'
}
}
stages {
stage('Do echo') {
steps {
sh 'env'
//sh 'exit 2'
}
}
}
post
{
always {
script {
GIT_COMMIT_EMAIL = sh (script: 'git --no-pager show -s --format=\'%ae\'',returnStdout: true).trim()
GIT_COMMIT_HASH_SHORT = sh (script: 'git log -n 1 --pretty=format:\'%h\'',returnStdout: true).trim()
GIT_COMMIT_HASH = sh (script: 'git rev-parse HEAD',returnStdout: true)
GIT_ORG= sh (script: 'git remote -v | tr \"\/.\" \":\" | cut -d \":\" -f3',returnStdout: true).trim()
GIT_REPO= sh (script: 'git remote -v | tr \"\/.\" \":\" | cut -d \":\" -f4',returnStdout: true).trim()
BUILD_STATUS = currentBuild.currentResult
mail to: 'nadav.daniel@lightapp.com',
subject: "Job '${JOB_NAME}' completed with status ${BUILD_STATUS}",
body: "${JOB_NAME} initialized by ${GIT_COMMIT_EMAIL} git commit https://github.com/${GIT_ORG}/${GIT_REPO}/commit/${GIT_COMMIT_HASH} server",
from: 'larobot@lightapp.com',
replyTo: 'larobot@lightapp.com'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment