Skip to content

Commit

Permalink
refactor Jenkins GitHub status postback to work on non-PR commits (op…
Browse files Browse the repository at this point in the history
  • Loading branch information
kibbles-n-bytes authored and pmorie committed Jun 7, 2017
1 parent 066159d commit 0d9b810
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ limitations under the License.
// TEST_ZONE: GCP Zone in which to create test GKE cluster
// TEST_ACCOUNT: GCP service account credentials (JSON file) to use for testing.

def repo_url = params.REPO_URL

def updatePullRequest(flow, success = false) {
def state, message
switch (flow) {
Expand All @@ -39,10 +41,14 @@ def updatePullRequest(flow, success = false) {
default:
error('flow can only be run or verify')
}
setGitHubPullRequestStatus(
context: env.JOB_NAME,
message: message,
state: state)

step([
$class: "GitHubCommitStatusSetter",
reposSource: [$class: "ManuallyEnteredRepositorySource", url: "${repo_url}"],
contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "${JOB_NAME}"],
errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]],
statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ]
]);
}

// Verify required parameters
Expand Down

0 comments on commit 0d9b810

Please sign in to comment.