[BuildMonitor] Add the filter func to remove the dropped project
authorSungHun Hwang <sh0924.hwang@samsung.com>
Fri, 10 Feb 2017 09:16:59 +0000 (18:16 +0900)
committerSoonKyu Park <sk7.park@samsung.com>
Thu, 23 Feb 2017 08:35:19 +0000 (17:35 +0900)
will be replaced 'prerelease' to 'trbs'
so the build status of the dropped prerelease projects
should not be shown at Tizen dashboard

add the filter func to remove the dropped project

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

index 7b2d01a..099d9f1 100644 (file)
@@ -85,6 +85,33 @@ def bm_disconnect_db():
 #===============================================================================
 # [job_submit.py]
 
+def get_src_proj_lst(bm_src_prj_lst):
+    print '[%s] enter get_src_proj_lst\n' % (__file__)
+
+    if not os.getenv("DROPPED_PRERELEASE_PROJECTS"):
+        print '[%s] no DROPPED_PRERELEASE_PROJECTS!!\n' % (__file__)
+        return bm_src_prj_lst
+
+    prefix = 'home:prerelease:'
+    dropped_prj_lst = os.getenv("DROPPED_PRERELEASE_PROJECTS").split(',')
+    #print '[%s] dropped_prj_lst(%s)\n' % (__file__, dropped_prj_lst)
+
+    print '[%s] bm_src_prj_lst (%s)\n' % (__file__, bm_src_prj_lst)
+    removed_lst = []
+    for each_src_proj in bm_src_prj_lst:
+        for each_dropped_proj in dropped_prj_lst:
+            #print '[%s] each_src_proj(%s), each_dropped_proj(%s)\n' \
+            #      % (__file__, each_src_proj, each_dropped_proj)
+            if each_src_proj.startswith(prefix + each_dropped_proj):
+                removed_lst.append(each_src_proj)
+                break
+
+    # do remove
+    print '[%s] removed_lst(%s), do remove!!\n' % (__file__, removed_lst)
+    bm_src_prj_lst = [x for x in bm_src_prj_lst if x not in removed_lst]
+
+    return bm_src_prj_lst
+
 def truncate_msg(msg):
     MAX_MSG_LEN = int(os.getenv("BUILDMONITOR_MAX_MSG_LEN"))
     ret_msg = (msg[:MAX_MSG_LEN-2] + '..') if len(msg) > MAX_MSG_LEN else msg
@@ -1760,7 +1787,13 @@ def main():
         gerrit_account_name = content.get("gerrit_account_name")
         bm_start_datetime = content.get("bm_start_datetime")
         bm_end_datetime = content.get("bm_end_datetime")
-        bm_src_project_lst = content.get("bm_src_project_lst")
+        bm_src_project_lst = get_src_proj_lst(content.get("bm_src_project_lst"))
+
+        # empty check
+        if not bm_src_project_lst:
+            print '[%s] bm_src_project_lst is empty, skip Submit stage!!\n' \
+                  % (__file__)
+            return
 
         # func call
         ### sr_status -> sr_commit -> sr_stage & sr_status_detail