From: Tobias von der Krone Date: Thu, 4 Jul 2013 07:43:24 +0000 (+0200) Subject: #507: make failed build not failing the jenkins job X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=0dd5691d1b8347d05229fa4c9f4cb546e09c71ee;p=profitbricks%2Fjenkins-build-scripts.git #507: make failed build not failing the jenkins job --- diff --git a/debian_build.py b/debian_build.py index 9e36c6e..0161918 100755 --- a/debian_build.py +++ b/debian_build.py @@ -111,11 +111,17 @@ if __name__ == '__main__': # .. actions, define defaults do_autoincrement = False do_cidb = False + no_cidb_cause = 'default' do_cleanup = True + no_cleanup_cause = 'unknown' do_liveboot_request = False + no_liveboot_cause = 'default' do_reports = True + no_reports_cause = 'unknown' do_tagging = False + no_tagging_cause = 'default' do_uploads = True + no_uploads_cause = 'unknown' # .. repository related gitrepo = git.Repo('.') @@ -198,11 +204,13 @@ if __name__ == '__main__': if not do_autoincrement and len(remote_tag) > 0: # FIXME: .id attribute but avl. in wheezy based git lib if remote_tag[0].commit.id == curr_commit_id: - logger.debug('Tag {name} was already created for commit {sha}.'.format( + message = 'Tag {name} was already created for commit {sha}.'.format( name=remote_tag[0].name, sha=remote_tag[0].commit.id[0:7], - )) + ) + logger.debug(message) do_tagging = False + no_tagging_cause = message else: logger.error('Tag {name} was already created for commit {sha}.'.format( name=remote_tag[0].name, @@ -306,7 +314,9 @@ if __name__ == '__main__': # # .. do some housekeeping first if not do_cleanup: - figlet('Cleanup skipped') + figlet('Cleanup skipped - {cause}'.format( + cause=no_cleanup_cause + )) else: # .. reset local repository at first logger.info('Reset and clean repository.') @@ -512,7 +522,13 @@ export {gbp_env} FORCE_SHELL=TRUE if ret: logger.error('git-buildpackage failed with exitcode {code}'.format(code=ret)) figlet('Build failed') - exit_error() + failed_message = 'package build has failed' + do_cidb = False + no_cidb_cause = failed_message + do_liveboot = False + no_liveboot_cause = failed_message + do_uploads = False + no_uploads_cause = failed_message else: figlet('Build OK') @@ -525,7 +541,9 @@ export {gbp_env} FORCE_SHELL=TRUE # if reports.tgz exists untar it to workspace and delete it. # reports.tgz is generated by /root/.pbuilder/hooks.d/B01-test if not do_reports: - figlet('Reports skipped') + figlet('Reports skipped - {cause}'.format( + cause=no_reports_cause + )) else: try: reports_file = os.path.join( @@ -547,7 +565,9 @@ export {gbp_env} FORCE_SHELL=TRUE # .. let's tag if not do_tagging: - figlet('Tagging skipped') + figlet('Tagging skipped - {cause}'.format( + cause=no_tagging_cause + )) else: try: gitrepo.git.tag(new_tag) @@ -568,11 +588,12 @@ export {gbp_env} FORCE_SHELL=TRUE # .. and upload if not do_uploads: - figlet('Upload skipped') + figlet('Upload skipped - {cause}'.format( + cause=no_uploads_cause + )) else: try: # strip epoch - dpkg_build_version = new_version if ":" in dpkg_build_version: dpkg_build_version = dpkg_build_version.split(":", 1)[1] @@ -611,7 +632,9 @@ export {gbp_env} FORCE_SHELL=TRUE # .. and add all the records to CIDB if not do_cidb: - figlet('CIDB skipped') + figlet('CIDB skipped - {cause}'.format( + cause=no_cidb_cause + )) else: package_instances = [] try: @@ -633,7 +656,9 @@ export {gbp_env} FORCE_SHELL=TRUE # .. finally trigger the next liveboot automatically if we succeed with CIDB if not do_liveboot_request: - figlet('Liveboot skipped') + figlet('Liveboot skipped - {cause}'.format( + cause=no_liveboot_cause + )) else: if len(package_instances) > 0: try: