From 87ac4c660dddc5ee35542b4ee0bf22c757203dd0 Mon Sep 17 00:00:00 2001 From: heliclei Date: Thu, 12 Jun 2014 11:30:37 +0800 Subject: [PATCH] [ci skip] Set github commit status context & description --- tools/jenkins-scripts/job-comment-trigger.py | 2 +- tools/jenkins-scripts/job-trigger.py | 2 +- tools/jenkins-scripts/post-build.py | 5 +++-- tools/jenkins-scripts/pull-request-builder.py | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/jenkins-scripts/job-comment-trigger.py b/tools/jenkins-scripts/job-comment-trigger.py index 8ba9d710af..b425040948 100644 --- a/tools/jenkins-scripts/job-comment-trigger.py +++ b/tools/jenkins-scripts/job-comment-trigger.py @@ -79,7 +79,7 @@ def main(): print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered' return(0) - data = {"state":"pending", "target_url":target_url} + data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Wait available build machine..."} access_token = os.environ['GITHUB_ACCESS_TOKEN'] Headers = {"Authorization":"token " + access_token} diff --git a/tools/jenkins-scripts/job-trigger.py b/tools/jenkins-scripts/job-trigger.py index 54e566e94c..fbdcf0c3e1 100755 --- a/tools/jenkins-scripts/job-trigger.py +++ b/tools/jenkins-scripts/job-trigger.py @@ -90,7 +90,7 @@ def main(): print 'skip build for pull request #' + str(pr_num) return(0) - data = {"state":"pending", "target_url":target_url} + data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Waiting available build machine..."} access_token = os.environ['GITHUB_ACCESS_TOKEN'] Headers = {"Authorization":"token " + access_token} diff --git a/tools/jenkins-scripts/post-build.py b/tools/jenkins-scripts/post-build.py index 78f7ddf735..fb99727de8 100644 --- a/tools/jenkins-scripts/post-build.py +++ b/tools/jenkins-scripts/post-build.py @@ -18,7 +18,7 @@ statuses_url = payload['statuses_url'] J = Jenkins(os.environ['JENKINS_URL']) target_url = os.environ['BUILD_URL'] build_number = int(os.environ['BUILD_NUMBER']) -data = {"state":"pending", "target_url":target_url} +data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Build finished!"} access_token = os.environ['GITHUB_ACCESS_TOKEN'] Headers = {"Authorization":"token " + access_token} @@ -26,9 +26,10 @@ result = J[os.environ['JOB_NAME']].get_build(build_number).get_status() if(result == STATUS_SUCCESS): data['state'] = "success" + data['description'] = "Build successfully!" else: data['state'] = "failure" - + data['description'] = "Build failed!" http_proxy = '' if(os.environ.has_key('HTTP_PROXY')): http_proxy = os.environ['HTTP_PROXY'] diff --git a/tools/jenkins-scripts/pull-request-builder.py b/tools/jenkins-scripts/pull-request-builder.py index d506bb0df5..eb36154c49 100755 --- a/tools/jenkins-scripts/pull-request-builder.py +++ b/tools/jenkins-scripts/pull-request-builder.py @@ -104,7 +104,7 @@ def main(): set_description(pr_desc, target_url) - data = {"state":"pending", "target_url":target_url} + data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Build started..."} access_token = os.environ['GITHUB_ACCESS_TOKEN'] Headers = {"Authorization":"token " + access_token}