[Jenkins][ci skip] Change 'payload' to 'tag'

This commit is contained in:
lm 2014-04-23 18:10:39 +08:00
parent 55911e1e78
commit 41615fe56a
2 changed files with 10 additions and 27 deletions

View File

@ -48,25 +48,14 @@ def make_temp_dir():
os.system(cmd)
def main():
#get payload from os env
payload_str = os.environ['payload']
payload_str = payload_str.decode('utf-8','ignore')
#parse to json obj
payload = json.loads(payload_str)
#get pull number
tag = payload['tag']
#get tag
tag = os.environ['tag']
print 'tag:' + tag
url = payload['html_url']
print "url:" + url
pr_desc = '<h3><a href=' + url + '>' + tag + ' is release' + '</a></h3>'
#get statuses url
statuses_url = payload['statuses_url']
pr_desc = '<h3>' + tag + ' is release' + '</h3>'
#get pr target branch
branch = payload['branch']
branch = 'develop'
#set parent build description
jenkins_url = os.environ['JENKINS_URL']
@ -76,16 +65,6 @@ def main():
set_description(pr_desc, target_url)
#set commit status to pending
data = {"state":"pending", "target_url":target_url}
access_token = os.environ['GITHUB_ACCESS_TOKEN']
Headers = {"Authorization":"token " + access_token}
try:
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
except:
traceback.print_exc()
#pull origin develop
os.system('git reset --hard')
os.system("git clean -xdf -f")

View File

@ -106,6 +106,10 @@ def main():
print 'job_trigger_url is: ', job_trigger_url
#send trigger and payload
if('tag' in payload_forword):
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)