This commit is contained in:
Firas Sawan 2020-03-09 21:41:51 -04:00
parent e27f25af28
commit 35f8656f0e

17
Jenkinsfile vendored
View file

@ -1,12 +1,5 @@
void setBuildStatus(String message, String state) {
step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/Firassawan/spring-petclinic"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}
String buildUrl = "${BUILD_URL}"
String gitStatusPostUrl = "https://<Github Personal Access Token>:x-oauth-basic@api.github.com/repos/<owner>/<repo>/statuses/${gitHash}"
pipeline {
agent any
@ -48,4 +41,8 @@ pipeline {
}
}
}
}
sh """
curl -X POST -H "application/json" -d '{"state":"success", "target_url":"${buildUrl}", "description":"Build Success", "context":"build/job"}' "${gitStatusPostUrl}"
"""