mirror of https://github.com/axmolengine/axmol.git
[Jenkins] watchdog
This commit is contained in:
parent
d1a84cd7e8
commit
9dcca7641c
|
@ -4,26 +4,24 @@ import sys
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def main():
|
#check & kill dead buid
|
||||||
username = os.environ['username']
|
def build_time(_job):
|
||||||
password = os.environ['password']
|
#get build duration
|
||||||
J = Jenkins('http://115.28.134.83:8000',username,password)
|
|
||||||
job = J['cocos-2dx-pull-request-build']
|
|
||||||
duration = os.environ['duration']
|
duration = os.environ['duration']
|
||||||
#Get the numerical ID of the last build.
|
#Get last build running
|
||||||
buildnu = job.get_last_buildnumber()
|
build = _job.get_last_build()
|
||||||
#Get the last build
|
|
||||||
build = job.get_last_build()
|
|
||||||
#Get the build running
|
|
||||||
running = build.is_running()
|
running = build.is_running()
|
||||||
print 'running:',running
|
print 'build_job:',_job,'running:',running
|
||||||
|
|
||||||
if not running:
|
if not running:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
#Get numerical ID of the last build.
|
||||||
|
buildnu = _job.get_last_buildnumber()
|
||||||
print "buildnumber:#",buildnu
|
print "buildnumber:#",buildnu
|
||||||
#get nowtime
|
#get nowtime
|
||||||
nowtime = time.strftime('%M',time.localtime(time.time()))
|
nowtime = time.strftime('%M',time.localtime(time.time()))
|
||||||
#print 'nowtime:',nowtime
|
#print 'nowtime:',nowtime
|
||||||
|
#get build start time
|
||||||
timeb = build.get_timestamp()
|
timeb = build.get_timestamp()
|
||||||
#print 'buildtime:',str(timeb)[14:16]
|
#print 'buildtime:',str(timeb)[14:16]
|
||||||
buildtime = int(str(timeb)[14:16])
|
buildtime = int(str(timeb)[14:16])
|
||||||
|
@ -34,8 +32,16 @@ def main():
|
||||||
subtime = 60-buildtime+int(nowtime)
|
subtime = 60-buildtime+int(nowtime)
|
||||||
if subtime > duration:
|
if subtime > duration:
|
||||||
#print 'subtime',subtime
|
#print 'subtime',subtime
|
||||||
|
#kill dead buid
|
||||||
build.stop()
|
build.stop()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
username = os.environ['username']
|
||||||
|
password = os.environ['password']
|
||||||
|
J = Jenkins('http://115.28.134.83:8000',username,password)
|
||||||
|
#get all jenkins jobs
|
||||||
|
for key,job in J.iteritems():
|
||||||
|
build_time(job)
|
||||||
return(0)
|
return(0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,3 +55,4 @@ if __name__ == '__main__':
|
||||||
sys_ret = 1
|
sys_ret = 1
|
||||||
finally:
|
finally:
|
||||||
sys.exit(sys_ret)
|
sys.exit(sys_ret)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue