From 2d9066ce7afa136fd39a5a7c9e1231bf331139af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daphn=C3=A9=20Augier?= Date: Sat, 11 Apr 2020 23:32:52 +0200 Subject: [PATCH] add success webhook for github --- Jenkinsfile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 97566aa84..d8debde32 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,11 +20,13 @@ pipeline { } } stage('Deploy') { - when { - branch 'development' + echo "Branch name: $(env.BRANCH_NAME)" + when { + branch 'master' } steps { - echo "DEPLOY!" + echo "Merge to master" + sh 'git pull' } } } @@ -34,6 +36,12 @@ pipeline { } success { echo 'I succeeeded!' + // For GitHub +curl "https://api.GitHub.com/repos/daphneaugier/spring-petclinic/statuses/$GIT_COMMIT?access_token=" \ + -H "Content-Type: application/json" \ + -X POST \ + -d "{\"state\": \"success\",\"context\": \"continuous-integration/jenkins\", \"description\": \"Jenkins\", \"target_url\": \"http://localhost:9090/job/spring-petclinic/$BUILD_NUMBER/console\"}" + // Email mail to: 'daphne.augier@gmail.com', subject: "Successful Pipeline: ${currentBuild.fullDisplayName}", body: "Eveythink OK with ${env.BUILD_URL}\n"