Fix exit handling of release and publish commands
If the commands can't proceed, exit 1 - actually triggering another pipeline is not yet implemented
This commit is contained in:
parent
0475cc8d6b
commit
622990aa02
@ -34,7 +34,8 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
|
|||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ToTestPublisher(self.tool).publish(project, opts.force)
|
if ToTestPublisher(self.tool).publish(project, opts.force) == QAResult.failed:
|
||||||
|
return 1
|
||||||
|
|
||||||
@cmdln.option('--force', action='store_true', help="Just update status")
|
@cmdln.option('--force', action='store_true', help="Just update status")
|
||||||
def do_wait_for_published(self, subcmd, opts, project):
|
def do_wait_for_published(self, subcmd, opts, project):
|
||||||
@ -54,7 +55,8 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
|
|||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ToTestReleaser(self.tool).release(project, opts.force)
|
if ToTestReleaser(self.tool).release(project, opts.force) == QAResult.failed:
|
||||||
|
return 1
|
||||||
|
|
||||||
def do_run(self, subcmd, opts, project):
|
def do_run(self, subcmd, opts, project):
|
||||||
"""${cmd_name}: run the ToTest Manager
|
"""${cmd_name}: run the ToTest Manager
|
||||||
@ -63,7 +65,6 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
|
|||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
if ToTestPublisher(self.tool).publish(project) == QAResult.passed:
|
if ToTestPublisher(self.tool).publish(project) == QAResult.passed:
|
||||||
ToTestPublisher(self.tool).wait_for_published(project)
|
ToTestPublisher(self.tool).wait_for_published(project)
|
||||||
ToTestReleaser(self.tool).release(project)
|
ToTestReleaser(self.tool).release(project)
|
||||||
|
@ -109,7 +109,7 @@ class ToTestManager(ToolBase.ToolBase):
|
|||||||
return result.group(1)
|
return result.group(1)
|
||||||
raise NotFoundException("can't find %s ftp version" % project)
|
raise NotFoundException("can't find %s ftp version" % project)
|
||||||
|
|
||||||
# make sure to update the attribute as atomar as possible - as such
|
# make sure to update the attribute as atomic as possible - as such
|
||||||
# only update the snapshot and don't erase anything else. The snapshots
|
# only update the snapshot and don't erase anything else. The snapshots
|
||||||
# have very different update times within the pipeline, so there is
|
# have very different update times within the pipeline, so there is
|
||||||
# normally no chance that releaser and publisher overwrite states
|
# normally no chance that releaser and publisher overwrite states
|
||||||
@ -118,7 +118,7 @@ class ToTestManager(ToolBase.ToolBase):
|
|||||||
if self.dryrun:
|
if self.dryrun:
|
||||||
self.logger.info('setting {} snapshot to {}'.format(status, snapshot))
|
self.logger.info('setting {} snapshot to {}'.format(status, snapshot))
|
||||||
return
|
return
|
||||||
if status_dict.get(status, '') != snapshot:
|
if status_dict.get(status) != snapshot:
|
||||||
status_dict[status] = snapshot
|
status_dict[status] = snapshot
|
||||||
text = yaml.safe_dump(status_dict)
|
text = yaml.safe_dump(status_dict)
|
||||||
self.api.attribute_value_save('ToTestManagerStatus', text)
|
self.api.attribute_value_save('ToTestManagerStatus', text)
|
||||||
@ -175,7 +175,7 @@ class ToTestManager(ToolBase.ToolBase):
|
|||||||
# meant to use the totest manager.
|
# meant to use the totest manager.
|
||||||
if repo.get('repository') in ('ports', 'factory', 'images_staging'):
|
if repo.get('repository') in ('ports', 'factory', 'images_staging'):
|
||||||
continue
|
continue
|
||||||
if repo.get('dirty', '') == 'true':
|
if repo.get('dirty') == 'true':
|
||||||
self.logger.info('%s %s %s -> %s' % (repo.get('project'),
|
self.logger.info('%s %s %s -> %s' % (repo.get('project'),
|
||||||
repo.get('repository'), repo.get('arch'), 'dirty'))
|
repo.get('repository'), repo.get('arch'), 'dirty'))
|
||||||
ready = False
|
ready = False
|
||||||
|
@ -171,7 +171,7 @@ class ToTestPublisher(ToTestManager):
|
|||||||
|
|
||||||
if self.get_status('publishing') == current_snapshot or self.get_status('published') == current_snapshot:
|
if self.get_status('publishing') == current_snapshot or self.get_status('published') == current_snapshot:
|
||||||
self.logger.info('{} is already publishing'.format(current_snapshot))
|
self.logger.info('{} is already publishing'.format(current_snapshot))
|
||||||
return QAResult.inprogress
|
return None
|
||||||
|
|
||||||
self.update_pinned_descr = False
|
self.update_pinned_descr = False
|
||||||
current_result = self.overall_result(current_snapshot)
|
current_result = self.overall_result(current_snapshot)
|
||||||
@ -214,7 +214,7 @@ class ToTestPublisher(ToTestManager):
|
|||||||
|
|
||||||
current_snapshot = self.get_status('publishing')
|
current_snapshot = self.get_status('publishing')
|
||||||
if self.dryrun:
|
if self.dryrun:
|
||||||
self.logger.info('Publisher finished, updating published snpashot to {}'.format(current_snapshot))
|
self.logger.info('Publisher finished, updating published snapshot to {}'.format(current_snapshot))
|
||||||
return
|
return
|
||||||
|
|
||||||
self.update_status('published', current_snapshot)
|
self.update_status('published', current_snapshot)
|
||||||
|
@ -14,7 +14,7 @@ from __future__ import print_function
|
|||||||
import re
|
import re
|
||||||
from xml.etree import cElementTree as ET
|
from xml.etree import cElementTree as ET
|
||||||
|
|
||||||
from ttm.manager import ToTestManager, NotFoundException
|
from ttm.manager import ToTestManager, NotFoundException, QAResult
|
||||||
|
|
||||||
class ToTestReleaser(ToTestManager):
|
class ToTestReleaser(ToTestManager):
|
||||||
|
|
||||||
@ -33,24 +33,24 @@ class ToTestReleaser(ToTestManager):
|
|||||||
# not overwriting
|
# not overwriting
|
||||||
if new_snapshot == testing_snapshot:
|
if new_snapshot == testing_snapshot:
|
||||||
self.logger.debug('no change in snapshot version')
|
self.logger.debug('no change in snapshot version')
|
||||||
return
|
return None
|
||||||
|
|
||||||
if testing_snapshot != self.get_status('failed') and testing_snapshot != self.get_status('published'):
|
if testing_snapshot != self.get_status('failed') and testing_snapshot != self.get_status('published'):
|
||||||
self.logger.debug('Snapshot {} is still in progress'.format(testing_snapshot))
|
self.logger.debug('Snapshot {} is still in progress'.format(testing_snapshot))
|
||||||
return
|
return QAResult.inprogress
|
||||||
|
|
||||||
self.logger.info('testing snapshot %s', testing_snapshot)
|
self.logger.info('testing snapshot %s', testing_snapshot)
|
||||||
self.logger.debug('new snapshot %s', new_snapshot)
|
self.logger.debug('new snapshot %s', new_snapshot)
|
||||||
|
|
||||||
if not self.is_snapshotable():
|
if not self.is_snapshotable():
|
||||||
self.logger.debug('not snapshotable')
|
self.logger.debug('not snapshotable')
|
||||||
return
|
return QAResult.failed
|
||||||
|
|
||||||
self.update_totest(new_snapshot)
|
self.update_totest(new_snapshot)
|
||||||
self.update_status('testing', new_snapshot)
|
self.update_status('testing', new_snapshot)
|
||||||
self.update_status('failed', '')
|
self.update_status('failed', '')
|
||||||
self.write_version_to_dashboard('totest', new_snapshot)
|
self.write_version_to_dashboard('totest', new_snapshot)
|
||||||
return 1
|
return QAResult.passed
|
||||||
|
|
||||||
def release_version(self):
|
def release_version(self):
|
||||||
url = self.api.makeurl(['build', self.project.name, 'standard', self.project.arch,
|
url = self.api.makeurl(['build', self.project.name, 'standard', self.project.arch,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user