Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions jenkins/pipelines/post-build-status-update.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env groovy

// DESCRIPTION:
// Sends the status of a node-test-commit-* sub build to the Github Bot, which
// then updates the corresponding PR's CI status on github.com.
// Updates the status of a GitHub pull request via the Github Bot. Primarily
// used for node-test-commit-* sub builds.

import groovy.json.JsonOutput

pipeline {
agent { label 'jenkins-workspace' }

parameters {
string(defaultValue: 'node', description: 'GitHub repository', name: 'REPO')
string(defaultValue: '', description: 'test/aix, linter, etc.', name: 'IDENTIFIER')
string(defaultValue: '', description: 'pending, success, unstable, failure', name: 'STATUS')
string(defaultValue: '', description: 'URL for upstream Jenkins job', name: 'URL')
Expand All @@ -21,13 +22,13 @@ pipeline {
stage('Send status report') {
steps {
validateParams(params)
sendBuildStatus(params.IDENTIFIER, params.STATUS, params.URL, params.COMMIT, params.REF)
sendBuildStatus(params.REPO, params.IDENTIFIER, params.STATUS, params.URL, params.COMMIT, params.REF)
}
}
}
}

def sendBuildStatus(identifier, status, url, commit, ref) {
def sendBuildStatus(repo, identifier, status, url, commit, ref) {
def path = ""
def message = ""

Expand Down Expand Up @@ -57,7 +58,7 @@ def sendBuildStatus(identifier, status, url, commit, ref) {

def script = "curl -s -o /dev/null --connect-timeout 5 -X POST " +
"-H 'Content-Type: application/json' -d '${buildPayload}' " +
"http://github-bot.nodejs.org:3333/node/jenkins/${path}"
"http://github-bot.nodejs.org:3333/${repo}/jenkins/${path}"

sh(returnStdout: true, script: script)
}
Expand Down