Created
March 5, 2019 02:06
-
-
Save begeeben/004e2febe1593ea644104a1e44b9419d to your computer and use it in GitHub Desktop.
Jenkins pipeline examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send build commit status to Github a pull request | |
def getCommitSha() { | |
dir('webfront_general') { | |
sh "git rev-parse HEAD > .git/current-commit" | |
return readFile(".git/current-commit").trim() | |
} | |
} | |
def setBuildStatus(String message, String state) { | |
step([ | |
$class: "GitHubCommitStatusSetter", | |
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/u-next/webfront_general.git"], | |
commitShaSource: [$class: "ManuallyEnteredShaSource", sha: getCommitSha()], | |
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"], | |
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], | |
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment