Skip to content

Commit

Permalink
Non-PR Jenkins jobs do not provide URL and commit author
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmo committed Aug 7, 2017
1 parent bbf8d75 commit 1cda057
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ pipeline {
stage('Checkout') {
steps {
checkout scm
sh 'printenv'
script {
env.COMMIT_ID = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
env.AUTHOR_NAME = sh(returnStdout: true, script: 'git show -s --pretty=%an HEAD').trim()
env.REPO_URL = sh(returnStdout: true, script: 'git remote get-url origin').trim()
}
sh 'printenv'
}
}
stage('Install tools') {
Expand Down Expand Up @@ -82,10 +84,10 @@ pipeline {
sh 'terraform destroy -force tests'
}
success {
slackSend channel: 'ecs-community-edition', color: 'good', message: "Build <${env.BUILD_URL}|#${env.BUILD_NUMBER}> passed: ${env.JOB_NAME}@${env.CHANGE_BRANCH} (<${env.CHANGE_URL}|${env.COMMIT_ID}>) by ${env.CHANGE_AUTHOR_DISPLAY_NAME}"
slackSend channel: 'ecs-community-edition', color: 'good', message: "Build <${env.BUILD_URL}|#${env.BUILD_NUMBER}> passed: ${env.JOB_NAME} (<${env.REPO_URL}|${env.COMMIT_ID}>) by ${env.AUTHOR_NAME}"
}
failure {
slackSend channel: 'ecs-community-edition', color: 'danger', message: "Build <${env.BUILD_URL}|#${env.BUILD_NUMBER}> failed: ${env.JOB_NAME}@${env.CHANGE_BRANCH} (<${env.CHANGE_URL}|${env.COMMIT_ID}>) by ${env.CHANGE_AUTHOR_DISPLAY_NAME}"
slackSend channel: 'ecs-community-edition', color: 'danger', message: "Build <${env.BUILD_URL}|#${env.BUILD_NUMBER}> failed: ${env.JOB_NAME} (<${env.REPO_URL}|${env.COMMIT_ID}>) by ${env.AUTHOR_NAME}"
}
}

Expand Down

0 comments on commit 1cda057

Please sign in to comment.