Merge pull request #6816 from shujunqiao/request-build-modify

[ci skip], modify request proxies in post-build.py and so on.
This commit is contained in:
minggo 2014-05-27 14:04:37 +08:00
commit c476e784fa
4 changed files with 18 additions and 8 deletions

View File

@ -8,6 +8,9 @@ import sys
import traceback
import urllib2
http_proxy = 'http://127.0.0.1:8087'
proxyDict = {'http':http_proxy,'https':http_proxy}
def main():
#get payload from os env
payload_str = os.environ['payload']
@ -82,7 +85,7 @@ def main():
if searchCI:
ciOper = searchCI.group()
if('rebuild' in ciOper):
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
except:
traceback.print_exc()
@ -112,7 +115,7 @@ def main():
else:
post_data = {'payload':""}
post_data['payload']= json.dumps(payload_forword)
requests.post(job_trigger_url, data=post_data)
requests.post(job_trigger_url, data=post_data, proxies = proxyDict)
return(0)

View File

@ -8,6 +8,9 @@ import sys
import traceback
from jenkinsapi.jenkins import Jenkins
http_proxy = 'http://127.0.0.1:8087'
proxyDict = {'http':http_proxy,'https':http_proxy}
def check_queue_build(action, pr_num, statuses_url):
username = os.environ['JENKINS_ADMIN']
password = os.environ['JENKINS_ADMIN_PW']
@ -26,7 +29,7 @@ def check_queue_build(action, pr_num, statuses_url):
access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token}
try:
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
except:
traceback.print_exc()
@ -71,7 +74,7 @@ def main():
print 'pull request #' + str(pr_num) + ' is '+action+', no build triggered'
return(0)
r = requests.get(pr['url']+"/commits")
r = requests.get(pr['url']+"/commits", proxies = proxyDict)
commits = r.json()
last_commit = commits[len(commits)-1]
message = last_commit['commit']['message']
@ -90,7 +93,7 @@ def main():
Headers = {"Authorization":"token " + access_token}
try:
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
except:
traceback.print_exc()
@ -98,7 +101,7 @@ def main():
#send trigger and payload
post_data = {'payload':""}
post_data['payload']= json.dumps(payload_forword)
requests.post(job_trigger_url, data=post_data)
requests.post(job_trigger_url, data=post_data, proxies = proxyDict)
return(0)

View File

@ -29,4 +29,6 @@ if(result == STATUS_SUCCESS):
else:
data['state'] = "failure"
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
http_proxy = 'http://127.0.0.1:8087'
proxyDict = {'http':http_proxy,'https':http_proxy}
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)

View File

@ -61,6 +61,8 @@ def check_current_3rd_libs(branch):
current_file = current_files[i]
copy(current_file, backup_file)
http_proxy = 'http://127.0.0.1:8087'
proxyDict = {'http':http_proxy,'https':http_proxy}
def main():
#get payload from os env
payload_str = os.environ['payload']
@ -105,7 +107,7 @@ def main():
Headers = {"Authorization":"token " + access_token}
try:
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
requests.post(statuses_url, data=json.dumps(data), headers=Headers, proxies = proxyDict)
except:
traceback.print_exc()