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
|
import urllib2
|
||||||
|
|
||||||
http_proxy = ''
|
http_proxy = ''
|
||||||
if(os.environ.has_key('HTTP_PROXY')):
|
if('HTTP_PROXY' in os.environ):
|
||||||
http_proxy = os.environ['HTTP_PROXY']
|
http_proxy = os.environ['HTTP_PROXY']
|
||||||
proxyDict = {'http':http_proxy,'https':http_proxy}
|
proxyDict = {'http': http_proxy, 'https': http_proxy}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#get payload from os env
|
#get payload from os env
|
||||||
|
@ -23,7 +23,7 @@ def main():
|
||||||
#get pull number
|
#get pull number
|
||||||
pr_num = issue['number']
|
pr_num = issue['number']
|
||||||
print 'pr_num:' + str(pr_num)
|
print 'pr_num:' + str(pr_num)
|
||||||
payload_forword = {"number":pr_num}
|
payload_forword = {"number": pr_num}
|
||||||
|
|
||||||
comment = payload['comment']
|
comment = payload['comment']
|
||||||
#get comment body
|
#get comment body
|
||||||
|
@ -75,19 +75,21 @@ def main():
|
||||||
#set commit status to pending
|
#set commit status to pending
|
||||||
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
target_url = os.environ['JOB_PULL_REQUEST_BUILD_URL']
|
||||||
|
|
||||||
if(action == 'closed' or action == 'assigned'):
|
if(action == 'closed' or action == 'assigned' or branch == 'v2'):
|
||||||
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, "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']
|
access_token = os.environ['GITHUB_ACCESS_TOKEN']
|
||||||
Headers = {"Authorization":"token " + access_token}
|
Headers = {"Authorization": "token " + access_token}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if searchCI:
|
if searchCI:
|
||||||
ciOper = searchCI.group()
|
ciOper = searchCI.group()
|
||||||
if('rebuild' in ciOper):
|
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:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
@ -112,12 +114,12 @@ def main():
|
||||||
|
|
||||||
#send trigger and payload
|
#send trigger and payload
|
||||||
if('tag' in payload_forword):
|
if('tag' in payload_forword):
|
||||||
post_data = {'tag':""}
|
post_data = {'tag': ""}
|
||||||
post_data['tag'] = payload_forword['tag']
|
post_data['tag'] = payload_forword['tag']
|
||||||
else:
|
else:
|
||||||
post_data = {'payload':""}
|
post_data = {'payload': ""}
|
||||||
post_data['payload']= json.dumps(payload_forword)
|
post_data['payload'] = json.dumps(payload_forword)
|
||||||
requests.post(job_trigger_url, data=post_data, proxies = proxyDict)
|
requests.post(job_trigger_url, data=post_data, proxies=proxyDict)
|
||||||
|
|
||||||
return(0)
|
return(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue