[BuildMonitor] change the build fail check method
authorSungHun Hwang <sh0924.hwang@samsung.com>
Sun, 26 Feb 2017 22:59:46 +0000 (07:59 +0900)
committerSungHun Hwang <sh0924.hwang@samsung.com>
Sun, 26 Feb 2017 23:15:08 +0000 (08:15 +0900)
change the build fail check method from the status of [build_project] table
to bBuildFail which is passed over from snapshot job

Signed-off-by: SungHun Hwang <sh0924.hwang@samsung.com>
job_buildmonitor.py

index b19b9d9..2765dd3 100644 (file)
@@ -373,7 +373,7 @@ def num_failed_packages_except_aggregate(build_project_id):
     # return the number of failed packages except *_aggregate packages.
     return failed_packages_cnt
 
-def start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime):
+def start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime, bBuildFail):
     print '[%s] enter start_pre_create_snapshot_for_sr_stage\n' % (__file__)
 
     # get curr_sr_status_id
@@ -389,44 +389,9 @@ def start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetim
     query_data = (curr_info_project_id,)
     curr_build_project_id = buildmonitor_db.get_value_from_query_data(query, query_data)
 
-    # [16_1206] if change the build fail check method, disable
-    '''
-    # << 1st >>
-    # get multi_build_status from build_target
-    query = "SELECT status FROM build_target WHERE build_project_id = %s " \
-            "AND last_flag = %s"
-    query_data = (curr_build_project_id, 'Y')
-    multi_build_status = buildmonitor_db.get_multi_values_from_query_data(query, query_data)
-    print '[%s] multi_build_status(%s)\n' % (__file__, multi_build_status)
-
-    # default 'S'
-    info_stage_status = 'S'
-    for each_build_status in multi_build_status:
-        #print '[%s] each_build_status(%s)\n' % (__file__, each_build_status)
-        if each_build_status[0] == 'F':
-            info_stage_status = 'F'
-            #print '[%s] failed!! info_stage_status(%s)\n' % (__file__, info_stage_status)
-    '''
-
-    # << 2nd >>
-    # get curr_build_project_status
-    query = "SELECT status FROM build_project WHERE info_project_id = %s"
-    query_data = (curr_info_project_id,)
-    curr_build_project_status = buildmonitor_db.get_value_from_query_data(query, query_data)
-    print '[%s] curr_build_project_status(%s)\n' % (__file__, curr_build_project_status)
-
-    # [16_1208] change the build fail check method from build_target status to build_project status
-    if curr_build_project_status == 'F':
+    print '[%s] bBuildFail(%s)\n' % (__file__, bBuildFail)
+    if bBuildFail == True:
         info_stage_status = 'F'
-
-        # if only *_aggregate packages are failed, make it 'S'
-        if num_failed_packages_except_aggregate(curr_build_project_id) == 0:
-            print
-            print ('[%s] The build status is determined as failed, ' % (__file__)),
-            print 'but only _aggregate packages are failed.'
-            print '[%s] So, final build status is corrected to S!' % (__file__)
-            info_stage_status = 'S'
-
     else:
         info_stage_status = 'S'
 
@@ -1401,7 +1366,7 @@ def TRBS_update_fail_status_for_sr_stage(project, bm_git_tag):
     query_data = ('F', curr_sr_status_id, info_stage_id, curr_build_project_id)
     buildmonitor_db.do_query(query, query_data)
 
-def TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime):
+def TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime, bBuildFail):
     print '[%s] enter TRBS_start_pre_create_snapshot_for_sr_stage\n' % (__file__)
 
     # get curr_sr_status_id
@@ -1417,7 +1382,6 @@ def TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_da
     query_data = (curr_info_project_id,)
     curr_build_project_id = buildmonitor_db.get_value_from_query_data(query, query_data)
 
-    # [16_1206] if change the build fail check method, disable
     '''
     # << 1st >>
     # get multi_build_status from build_target
@@ -1434,7 +1398,6 @@ def TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_da
         if each_build_status[0] == 'F':
             info_stage_status = 'F'
             #print '[%s] failed!! info_stage_status(%s)\n' % (__file__, info_stage_status)
-    '''
 
     # << 2nd >>
     # get curr_build_project_status
@@ -1448,6 +1411,14 @@ def TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_da
         info_stage_status = 'F'
     else:
         info_stage_status = 'S'
+    '''
+
+    # << 3rd >>
+    print '[%s] bBuildFail(%s)\n' % (__file__, bBuildFail)
+    if bBuildFail == True:
+        info_stage_status = 'F'
+    else:
+        info_stage_status = 'S'
 
     ### [TRBS_BUILD] stage end : [trbs] package build
     info_stage_id = TRBS_BUILD
@@ -1829,12 +1800,12 @@ def main():
         # func call
         if bm_stage == 'Pre_Snap_Start':
             print '[%s][Pre_Snap_Start]\n' % (__file__)
-            start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime)
+            start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime, bBuildFail)
 
         # [17_0110] TRBS
         if bm_stage == '[TRBS]_Pre_Snap_Start':
             print '[%s][[TRBS]_Pre_Snap_Start]\n' % (__file__)
-            TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime)
+            TRBS_start_pre_create_snapshot_for_sr_stage(project, bm_git_tag, bm_start_datetime, bBuildFail)
 
         # if bBuildFail is True then skip Creating images
         if bBuildFail != True: