TPE446 Do not block pre-release-create if no snapshot running with the same target 68/158668/1
authorhyokeun <hyokeun.jeon@samsung.com>
Thu, 2 Nov 2017 09:50:04 +0000 (18:50 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Thu, 2 Nov 2017 09:50:04 +0000 (18:50 +0900)
Change-Id: I9e923b80aec8b6fcdec2d36f2f3ea8af7357c313

job_jobs_dispatcher.py

index 9469fb5..cf55982 100755 (executable)
@@ -53,6 +53,16 @@ def isReadyForCreateSnapshot(build, backenddb, project):
 
     return True
 
+def make_prefix_trigger_file(target_project):
+    iso_list = os.getenv('ISOLATE_SNAPSHOT', None)
+    if iso_list is None:
+        return ''
+    for x in iso_list.split(','):
+        _prj, _prefix = x.split('=')
+        if _prj == target_project:
+            return _prefix.upper()
+    return ''
+
 def main(obs_event_fields):
     """The main body"""
 
@@ -72,6 +82,7 @@ def main(obs_event_fields):
             if(isReadyForPrerelease(build, project)):
                 print 'All the repositories are published for project %s.' \
                       'Triggering the prerelease.' % (project)
+                target_project_name = ''
                 try:
                     target_project_name = get_info_from_prerelease_name(project)[0]
                     buildmonitor_db.connect_db()
@@ -83,7 +94,9 @@ def main(obs_event_fields):
                 except Exception as err:
                     buildmonitor_db.disconnect_db()
                     print repr(err)
-                trigger_next('#PRERELEASE#%s#%s' %(project,event_type),obs_event_fields)
+                trigger_next('%s#PRERELEASE#%s#%s' \
+                             % (make_prefix_trigger_file(target_project_name), project, event_type), \
+                             obs_event_fields)
         elif(is_trbs_project(project)):
             if(isReadyForTrbs(build, project)):
                 print 'All the repositories are published for project %s.' \
@@ -93,7 +106,9 @@ def main(obs_event_fields):
             if(isReadyForCreateSnapshot(build, backenddb, project)):
                 print 'All the repositories are published for project %s.' \
                       'Triggering the creating snapshot job..'%(project)
-                trigger_next('#SNAP#%s#%s' %(project,event_type),obs_event_fields)
+                trigger_next('%s#SNAP#%s#%s' \
+                             % (make_prefix_trigger_file(project), project, event_type), \
+                             obs_event_fields)
     else:
         trigger_next('#%s#%s' %(project,obs_event_fields['event_type']),
                      obs_event_fields)