]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
more debugging and make the build fail if package instance cannot be added to cidb
authorHolger Levsen <holger@layer-acht.org>
Fri, 28 Sep 2012 16:03:45 +0000 (18:03 +0200)
committerHolger Levsen <holger@layer-acht.org>
Fri, 28 Sep 2012 16:03:45 +0000 (18:03 +0200)
db_add.py
debian_build.py

index bb40fc8d657643fa3ed46c73a0d01172ef97f7b7..9b1abe6da8c6c20fd681b013e7bfbc36e8162735 100755 (executable)
--- 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)
index be00d0fa06493a16c14abc00d89d365dfbc775a9..0299e2fb57542f5d964193aa6f250546170c0146 100755 (executable)
@@ -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)