mirror of https://github.com/axmolengine/axmol.git
disable comment job trigger for v2 branch
This commit is contained in:
parent
fdb03f150d
commit
68f86adab1
|
@ -7,9 +7,9 @@ import traceback
|
|||
import urllib2
|
||||
|
||||
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}
|
||||
proxyDict = {'http': http_proxy, 'https': http_proxy}
|
||||
|
||||
def main():
|
||||
#get payload from os env
|
||||
|
@ -23,7 +23,7 @@ def main():
|
|||
#get pull number
|
||||
pr_num = issue['number']
|
||||
print 'pr_num:' + str(pr_num)
|
||||
payload_forword = {"number":pr_num}
|
||||
payload_forword = {"number": pr_num}
|
||||
|
||||
comment = payload['comment']
|
||||
#get comment body
|
||||
|
@ -75,19 +75,21 @@ def main():
|
|||
#set commit status to pending
|
||||
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
||||
|
||||
if(action == 'closed' or action == 'assigned'):
|
||||
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
|
||||
if(action == 'closed' or action == 'assigned' or branch == 'v2'):
|
||||
print 'pull request #' + str(pr_num) + ' is ' + action + ', no build triggered'
|
||||
return(0)
|
||||
|
||||
data = {"state":"pending", "target_url":target_url, "context":"Jenkins CI", "description":"Wait available build machine..."}
|
||||
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}
|
||||
Headers = {"Authorization": "token " + access_token}
|
||||
|
||||
try:
|
||||
if searchCI:
|
||||
ciOper = searchCI.group()
|
||||
if('rebuild' in ciOper):
|
||||
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()
|
||||
|
||||
|
@ -112,12 +114,12 @@ def main():
|
|||
|
||||
#send trigger and payload
|
||||
if('tag' in payload_forword):
|
||||
post_data = {'tag':""}
|
||||
post_data = {'tag': ""}
|
||||
post_data['tag'] = payload_forword['tag']
|
||||
else:
|
||||
post_data = {'payload':""}
|
||||
post_data['payload']= json.dumps(payload_forword)
|
||||
requests.post(job_trigger_url, data=post_data, proxies = proxyDict)
|
||||
post_data = {'payload': ""}
|
||||
post_data['payload'] = json.dumps(payload_forword)
|
||||
requests.post(job_trigger_url, data=post_data, proxies=proxyDict)
|
||||
|
||||
return(0)
|
||||
|
||||
|
|
Loading…
Reference in New Issue