Merge "Actually, you know, return the timeout" into feature/zuulv3
This commit is contained in:
commit
eb5a6a8781
|
@ -507,15 +507,19 @@ class Job:
|
||||||
self.jjb_job = jobs[self.orig]
|
self.jjb_job = jobs[self.orig]
|
||||||
|
|
||||||
def getTimeout(self):
|
def getTimeout(self):
|
||||||
|
timeout = None
|
||||||
if self.jjb_job:
|
if self.jjb_job:
|
||||||
for wrapper in self.jjb_job.get('wrappers', []):
|
for wrapper in self.jjb_job.get('wrappers', []):
|
||||||
if isinstance(wrapper, dict):
|
if isinstance(wrapper, dict):
|
||||||
build_timeout = wrapper.get('timeout')
|
build_timeout = wrapper.get(
|
||||||
|
'build-timeout', wrapper.get('timeout'))
|
||||||
if isinstance(build_timeout, dict):
|
if isinstance(build_timeout, dict):
|
||||||
timeout = build_timeout.get('timeout')
|
timeout = build_timeout.get('timeout')
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
timeout = int(timeout) * 60
|
timeout = int(timeout) * 60
|
||||||
|
|
||||||
|
return timeout
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def short_name(self):
|
def short_name(self):
|
||||||
return self.name.replace('legacy-', '')
|
return self.name.replace('legacy-', '')
|
||||||
|
@ -845,9 +849,11 @@ class Job:
|
||||||
|
|
||||||
if self.vars:
|
if self.vars:
|
||||||
output['vars'] = self.vars.copy()
|
output['vars'] = self.vars.copy()
|
||||||
|
|
||||||
timeout = self.getTimeout()
|
timeout = self.getTimeout()
|
||||||
if timeout:
|
if timeout:
|
||||||
output['timeout'] = timeout
|
output['timeout'] = timeout
|
||||||
|
output.setdefault('vars', {})
|
||||||
output['vars']['BUILD_TIMEOUT'] = str(timeout * 1000)
|
output['vars']['BUILD_TIMEOUT'] = str(timeout * 1000)
|
||||||
|
|
||||||
if self.nodes:
|
if self.nodes:
|
||||||
|
|
Loading…
Reference in New Issue