From: Holger Levsen Date: Fri, 28 Sep 2012 16:03:45 +0000 (+0200) Subject: more debugging and make the build fail if package instance cannot be added to cidb X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=b500ad3520ee577261afcca74ac6c3ea8afda0d1;p=profitbricks%2Fjenkins-build-scripts.git more debugging and make the build fail if package instance cannot be added to cidb --- diff --git a/db_add.py b/db_add.py index bb40fc8..9b1abe6 100755 --- a/db_add.py +++ b/db_add.py @@ -84,16 +84,16 @@ def db_add_package_instance(con, package_id, origin_id, build_result_id, version def add_package_instances(origin, job_name, build_number, changes_file, version, start, end): con = db_connect() - #logger.debug("save %s to database" %(job_name)) + logger.debug("save %s to database" %(job_name)) db_origin_id = db_add_origin(con, origin) - #logger.debug("INSERT success origin %s" % origin) + logger.debug("INSERT success origin %s" % origin) db_job_id = db_add_job(con, job_name) - #logger.debug("INSERT success job %s" % job_name) + logger.debug("INSERT success job %s" % job_name) # maybe FIXME: we could add the build already once its started, but for package builds we dont wanna add failures to the db at all db_build_id = db_add_build (con, build_number, db_job_id) db_build_result_id = db_add_build_result (con, db_build_id, start, end) - #logger.debug("INSERT success build number %s" % build_number) - #logger.debug("processing %s" %(changes_file)) + logger.debug("INSERT success build number %s" % build_number) + logger.debug("processing %s" %(changes_file)) cmd = ["dcmd", '--deb', changes_file] cmdobj = subprocess.Popen( cmd, @@ -109,9 +109,9 @@ def add_package_instances(origin, job_name, build_number, changes_file, version, db_package_instance_ids=[] for line in cmdobj.stdout.readlines(): package = os.path.basename(line.strip()).split('_')[0] - #logger.debug('package: %s' %(package)) + logger.debug('package: %s' %(package)) db_package_id = db_add_package (con, package) - #logger.debug("INSERT success package %s" % package) + logger.debug("INSERT success package %s" % package) db_package_instance_ids.append(db_add_package_instance (con, db_package_id, db_origin_id, db_build_result_id, version)) logger.debug("INSERT success package version %s %s" %( package,version)) #logger.debug('Cmd returned with status %d' %(cmdobj.returncode)) @@ -122,7 +122,6 @@ def add_package_instances(origin, job_name, build_number, changes_file, version, def add_package_version(origin, package, version): logger = logger_init() con = db_connect() - #logger.debug("save %s to database" %(job_name)) db_origin_id = db_add_origin(con, origin) db_package_id = db_add_package (con, package) db_package_instance_id = db_add_package_instance (con, db_package_id, db_origin_id, 'NULL', version) diff --git a/debian_build.py b/debian_build.py index be00d0f..0299e2f 100755 --- a/debian_build.py +++ b/debian_build.py @@ -577,10 +577,10 @@ if __name__ == '__main__': try: package_instances = add_package_instance("profitbricks", BUILD_JOBNAME, BUILD_NUMBER, changes_file, version, BUILD_START, BUILD_END) except Exception, error: - cmd = ['figlet-figlet', '-t', 'package instance not added to DB'] + cmd = ['figlet-figlet', '-t', 'CIDB problem:'] subprocess.check_call(cmd) - #FIXME: this should really cause an error - # exit_error() + logger_error("package instance not added to DB") + exit_error() if len(package_instances) > 0: try: add_liveboot_request(package_instances)