?????????????????????????
?????и??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Щ????????????????ж????????????????????????????????????dailyrun??????????test???????????????汾??????????????????????????汾?????з???????????????????????????????????????????е??????????ut??ft???????????????Щ?????????????????????????????????????????????????????ò?????????????????????????????????С?
?????????У?
??????1????????jenkins?????????????????????????????????????磬?????鶼????????β???????Σ?
??????2????????????????????????????????????????????????????????????????????????????????????У?
??????3???????????????????鷳????????????????????????η?????????????????汾????????????jenkins??????git?????汾?????????
??????4?????????????????????е???????????????????????????????????????????????????build??Ρ?deploy??Ρ?ut??λ?????ft??????????ε??????????????????飻
???????????????????????
?????????????????????jenkins????????????????????????????????????????????????????????????1??
??????Σ???????????ó?????????jenkins???????????????????????????????????????????????У?????????2??
????????????jenkins??????????????????mysql?У??????????????????????jenkins api?????git???????????????????????????????3??
????????????????????????????????????????????????????????????????????????????????mysql??????У?????????web??????
????jenkins ?????????api?????????????????????????????????????????????Щ???????????
???????????Ч??????????????????????????????jenkins?????????????????????????????·???????????????????????????????У???????????и??????ò?????????
???????tip????jenkins slave????????????ssh???????jenkins master??????????????slave failover????????slave??????master?????????????????????
????????????????????????
[
[{"jobname":"Cupid"??"slave":"TEST3-JK-10"}]??
[{"jobname":"Cupid-HiveTest"??"slave":"TEST3-JK-1"}]??
[{"jobname":"git-console"??"slave":"TEST3-JK-10.1"}]??
[{"jobname":"git-console-public"??"slave":"TEST3-2"}]??
[{"jobname":"OpenMrLocal"??"slave":"TEST3-JK-10"}]??
[{"jobname":"OpenMrOnLot"??"slave":"TEST3-JK-10"}]??
[{"jobname":"Graph"??"slave":"TEST3-JK-1222"}]??
[{"jobname":"MR"??"slave":"TEST3-JK-101"}]??
[{"jobname":"SqlTask-Finance"??"slave":"TEST3-JK-1180"}]??
[{"jobname":"SqlTask-Lot"??"slave":"TEST3-JK-1010"}]??
[{"jobname":"Moye"??"slave":"TEST3-JK-10"}]??
[{"jobname":"Security"??"slave":"TEST3-JK-1"}]??
[{"jobname":"SqlTask-Chinese"??"slave":"TEST3-JK-1"}]??
[{"jobname":"SqlTask-ServiceMode"??"slave":"TEST3-JK-1"}]??
[{"jobname":"SqlTask-Taobao"??"slave":"TEST3-JK-1"}]??
[{"jobname":"XLib"??"slave":"TEST3-JK-1"}]??
[{"jobname":"RESTFulAPI"??"slave":"TEST3-JK-1"}??{"jobname":"RESTFulAPI-AdminTask"??"slave":"TEST3-JK-1"}??{"jobname":"RESTFulAPI-Event"??"slave":"TEST3-JK-1"}]??
[{"jobname":"CopyTask"??"slave":"Test-1"}]??
[{"jobname":"ReplicationTask"??"slave":"Test-10"}]??
[{"jobname":"MetaTest-FromFinance"??"slave":"TEST3-JK-1"}]??
[{"jobname":"Console-UT"??"slave":"TEST3-JK-1693"}]??
[{"jobname":"SDK-UT"??"slave":"TEST3-JK-100"}]??
[{"jobname":"PL-492"??"slave":"1"}]??
[{"jobname":"FT-gcc492"??"slave":"Test-vm-13"}]??
[{"jobname":"RESTApi-FT"??"slave":"Test-vm-13"}]??
[{"jobname":"FT"??"slave":"Test-vm-10"}]??
[{"jobname":"Api-FT-gcc492"??"slave":"Test-vm-1"}]??
[{"jobname":"CppSdk-FT-gcc492"??"slave":"Test-vm-1"}]??
[{"jobname":"OldSdk-FT-gcc492"??"slave":"Test-vm-1"}]??
[{"jobname":"Lot"??"slave":"TEST3-JK-1"}]
]
????????????????????????????????????е????????????????????????????????????????????????????????????????????????????????????????????????????startbuilds???????????????API??????jenkins api????
# -*- coding: utf-8 -*-
import jenkins
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
sys.path.append("./pkg")
sys.path.append("./pkg/jenkinsapi")
sys.path.append("./pkg/pytz")
sys.path.append("./pkg/requests")
sys.path.append("../watchmen/watchmen_upload/")
import common ??cfg ??watchmen_upload
from param import get_job_xml??get_job_slave??get_job_cfgparam??get_job_child??getAllJob??gendict??rerun??build_job_poll??build_job
if __name__ == "__main__":
print "start job dependencies"
if len(sys.argv) < 2:
print "please input the jobName"
exit(1)
args = sys.argv[1]
print "jobName===>"+args
api = jenkins.API()
stime= common.getNow()
api.startbuild(args)
??????????????jenkins?????git???y??????
def modify_branch(jobname??new_branch):
print(jobname)
if jobname=="None" or jobname is None :
return
jkserver=jenkins.API().get_jenkins_instance()
job=jkserver.get_job(jobname)
try:
branch=job.get_scm_branch()
except Exception??e:
print e
return
print(branch)
job.modify_scm_branch(new_branch)
branch=job.get_scm_branch()
print(branch)
???????????н???????飬???????????restful?????????????????????????????????????????????????????ftp???棬?????????????????????????????????????????Щ???????????????????Щ???????????У??????webserver????????