Block adi command from accepting if checks aren't succeeding

This commit is contained in:
Stephan Kulow 2019-03-07 20:03:06 +01:00
parent 819d437e72
commit 578d0a7ddc

View File

@ -29,31 +29,39 @@ class AdiCommand:
def check_adi_project(self, project):
query_project = self.api.extract_staging_short(project)
info = self.api.project_status(project, True)
if len(info['selected_requests']):
if len(info['building_repositories']):
print(query_project + " " + Fore.MAGENTA + 'building')
print(query_project + ' ' + Fore.MAGENTA + 'building')
return
if len(info['untracked_requests']):
print(query_project + " " + Fore.YELLOW + 'untracked: ' + ', '.join(['{}[{}]'.format(
print(query_project + ' ' + Fore.YELLOW + 'untracked: ' + ', '.join(['{}[{}]'.format(
Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['untracked_requests']]))
return
if len(info['obsolete_requests']):
print(query_project + " " + Fore.YELLOW + 'obsolete: ' + ', '.join(['{}[{}]'.format(
print(query_project + ' ' + Fore.YELLOW + 'obsolete: ' + ', '.join(['{}[{}]'.format(
Fore.CYAN + req['package'] + Fore.RESET, req['number']) for req in info['obsolete_requests']]))
return
if len(info['broken_packages']):
print(query_project + " " + Fore.RED + 'broken: ' + ', '.join([
print(query_project + ' ' + Fore.RED + 'broken: ' + ', '.join([
Fore.CYAN + p['package'] + Fore.RESET for p in info['broken_packages']]))
return
for review in info['missing_reviews']:
print(query_project + " " + Fore.WHITE + 'review: ' + '{} for {}[{}]'.format(
print(query_project + ' ' + Fore.WHITE + 'review: ' + '{} for {}[{}]'.format(
Fore.YELLOW + review['by'] + Fore.RESET,
Fore.CYAN + review['package'] + Fore.RESET,
review['request']))
return
for check in info['missing_checks']:
print(query_project + ' ' + Fore.MAGENTA + 'missing: {}'.format(check))
return
for check in project.get('checks', []):
if check['state'] != 'success':
print(query_project + '{} {} check: {}'.format(Fore.MAGENTA, check['state'], check['name']))
return
if self.api.is_user_member_of(self.api.user, self.api.cstaging_group):
print(query_project + " " + Fore.GREEN + 'ready')
print(query_project + ' ' + Fore.GREEN + 'ready')
packages = []
for req in info['selected_requests']:
print(' - {} [{}]'.format(Fore.CYAN + req['package'] + Fore.RESET, req['number']))