forked from openlp/openlp
Add a way to continue watching all jobs, even if one fails
This commit is contained in:
parent
e5d82de5db
commit
287debf9cf
@ -116,7 +116,7 @@ class JenkinsTrigger(object):
|
|||||||
self.fetch_jobs()
|
self.fetch_jobs()
|
||||||
self.server.build_job(OpenLPJobs.Branch_Pull, {'BRANCH_NAME': self.repo_name, 'cause': cause})
|
self.server.build_job(OpenLPJobs.Branch_Pull, {'BRANCH_NAME': self.repo_name, 'cause': cause})
|
||||||
|
|
||||||
def print_output(self):
|
def print_output(self, can_continue=False):
|
||||||
"""
|
"""
|
||||||
Print the status information of the build triggered.
|
Print the status information of the build triggered.
|
||||||
"""
|
"""
|
||||||
@ -127,13 +127,21 @@ class JenkinsTrigger(object):
|
|||||||
revno = raw_output.decode().strip()
|
revno = raw_output.decode().strip()
|
||||||
print('%s (revision %s)' % (get_repo_name(), revno))
|
print('%s (revision %s)' % (get_repo_name(), revno))
|
||||||
|
|
||||||
|
failed_builds = []
|
||||||
for job in OpenLPJobs.Jobs:
|
for job in OpenLPJobs.Jobs:
|
||||||
if not self.__print_build_info(job):
|
if not self.__print_build_info(job):
|
||||||
if self.current_build:
|
if self.current_build:
|
||||||
print('Stopping after failure, see {}console for more details'.format(self.current_build['url']))
|
failed_builds.append((self.current_build['fullDisplayName'], self.current_build['url']))
|
||||||
else:
|
if not can_continue:
|
||||||
print('Stopping after failure')
|
print('Stopping after failure')
|
||||||
break
|
break
|
||||||
|
print('')
|
||||||
|
if failed_builds:
|
||||||
|
print('Failed builds:')
|
||||||
|
for build_name, url in failed_builds:
|
||||||
|
print(' - {}: {}console'.format(build_name, url))
|
||||||
|
else:
|
||||||
|
print('All builds passed')
|
||||||
|
|
||||||
def open_browser(self):
|
def open_browser(self):
|
||||||
"""
|
"""
|
||||||
@ -228,6 +236,7 @@ def main():
|
|||||||
help='Disable coloured output (always disabled on Windows)')
|
help='Disable coloured output (always disabled on Windows)')
|
||||||
parser.add_argument('-u', '--username', required=True, help='Your Jenkins username')
|
parser.add_argument('-u', '--username', required=True, help='Your Jenkins username')
|
||||||
parser.add_argument('-p', '--password', required=True, help='Your Jenkins password or personal token')
|
parser.add_argument('-p', '--password', required=True, help='Your Jenkins password or personal token')
|
||||||
|
parser.add_argument('-c', '--always-continue', action='store_true', default=False, help='Continue despite failure')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if not get_repo_name():
|
if not get_repo_name():
|
||||||
@ -239,7 +248,7 @@ def main():
|
|||||||
if args.open_browser:
|
if args.open_browser:
|
||||||
jenkins_trigger.open_browser()
|
jenkins_trigger.open_browser()
|
||||||
if not args.disable_output:
|
if not args.disable_output:
|
||||||
jenkins_trigger.print_output()
|
jenkins_trigger.print_output(can_continue=args.always_continue)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user