don't trigger for v2 build

This commit is contained in:
andyque 2015-04-13 09:46:00 +08:00
parent 29de9d397f
commit fdb03f150d
1 changed files with 42 additions and 38 deletions

View File

@ -12,7 +12,7 @@ access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization": "token " + access_token}
http_proxy = ''
if(os.environ.has_key('HTTP_PROXY')):
if('HTTP_PROXY' in os.environ):
http_proxy = os.environ['HTTP_PROXY']
proxyDict = {'http': http_proxy, 'https': http_proxy}
@ -33,7 +33,8 @@ def check_queue_build(action, pr_num, statuses_url):
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
data = {"state": "error", "target_url": target_url}
try:
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
requests.post(statuses_url, data=json.dumps(data),
headers=Headers, proxies=proxyDict)
except:
traceback.print_exc()
@ -74,7 +75,8 @@ def main():
except:
print 'Can not find build in queue'
if(action == 'closed' or action == 'labeled' or action == 'assigned' or action == 'unlabeled'):
if(action == 'closed' or action == 'labeled'
or action == 'assigned' or action == 'unlabeled' or branch == 'v2'):
print 'pull request #' + str(pr_num) + ' is ' + action + ', no build triggered'
return(0)
@ -92,11 +94,13 @@ def main():
print 'skip build for pull request #' + str(pr_num)
return(0)
data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Waiting available build machine..."}
data = {"state": "pending", "target_url": target_url,
"context": "Jenkins CI",
"description": "Waiting available build machine..."}
try:
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
requests.post(statuses_url, data=json.dumps(data),
headers=Headers, proxies=proxyDict)
except:
traceback.print_exc()