Merge pull request #7045 from heliclei/commit-status-desc

[ci skip] Set github commit status context & description
This commit is contained in:
minggo 2014-06-12 14:40:55 +08:00
commit 85a9e85dfd
4 changed files with 6 additions and 5 deletions

View File

@ -79,7 +79,7 @@ def main():
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered' print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
return(0) 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'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}

View File

@ -90,7 +90,7 @@ def main():
print 'skip build for pull request #' + str(pr_num) print 'skip build for pull request #' + str(pr_num)
return(0) 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'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}

View File

@ -18,7 +18,7 @@ statuses_url = payload['statuses_url']
J = Jenkins(os.environ['JENKINS_URL']) J = Jenkins(os.environ['JENKINS_URL'])
target_url = os.environ['BUILD_URL'] target_url = os.environ['BUILD_URL']
build_number = int(os.environ['BUILD_NUMBER']) 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'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + 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): if(result == STATUS_SUCCESS):
data['state'] = "success" data['state'] = "success"
data['description'] = "Build successfully!"
else: else:
data['state'] = "failure" data['state'] = "failure"
data['description'] = "Build failed!"
http_proxy = '' http_proxy = ''
if(os.environ.has_key('HTTP_PROXY')): if(os.environ.has_key('HTTP_PROXY')):
http_proxy = os.environ['HTTP_PROXY'] http_proxy = os.environ['HTTP_PROXY']

View File

@ -104,7 +104,7 @@ def main():
set_description(pr_desc, target_url) 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'] access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token} Headers = {"Authorization":"token " + access_token}