Fix up a couple of issues, and move URL creation to where the job info is pulled

This commit is contained in:
Raoul Snyman 2017-11-10 10:51:42 -07:00
parent a9692f8391
commit dd2d1002ce

View File

@ -101,6 +101,7 @@ class JenkinsTrigger(object):
for job_name in OpenLPJobs.Jobs: for job_name in OpenLPJobs.Jobs:
job_info = self.server.get_job_info(job_name) job_info = self.server.get_job_info(job_name)
self.jobs[job_name] = job_info self.jobs[job_name] = job_info
self.jobs[job_name]['nextBuildUrl'] = '{url}{nextBuildNumber}/'.format(**job_info)
def trigger_build(self): def trigger_build(self):
""" """
@ -163,13 +164,13 @@ class JenkinsTrigger(object):
variables from the :class:`OpenLPJobs` class. variables from the :class:`OpenLPJobs` class.
""" """
job = self.jobs[job_name] job = self.jobs[job_name]
print('{:<70} [WAITING]'.format(job['url'] + '/' + job['nextBuildNumber']), end='', flush=True) print('{:<70} [WAITING]'.format(job['nextBuildUrl']), end='', flush=True)
self.current_build = self._get_build_info(job_name, job[job_name]['nextBuildNumber']) self.current_build = self._get_build_info(job_name, job['nextBuildNumber'])
print('\b\b\b\b\b\b\b\b\b[RUNNING]', end='', flush=True) print('\b\b\b\b\b\b\b\b\b[RUNNING]', end='', flush=True)
is_success = False is_success = False
while self.current_build['building'] is True: while self.current_build['building'] is True:
time.sleep(0.5) time.sleep(0.5)
self.current_build = self.server.get_build_info(job_name, self.build_number[job_name]) self.current_build = self.server.get_build_info(job_name, job['nextBuildNumber'])
result_string = self.current_build['result'] result_string = self.current_build['result']
is_success = result_string == 'SUCCESS' is_success = result_string == 'SUCCESS'
if self.can_use_colour: if self.can_use_colour: