Trigger next "RSYNC" for the download server 68/174868/1
authorYonghee Han <onstudy@samsung.com>
Wed, 4 Apr 2018 12:53:54 +0000 (21:53 +0900)
committerYonghee Han <onstudy@samsung.com>
Wed, 4 Apr 2018 12:54:00 +0000 (21:54 +0900)
1) after update to internel download, must rsync to mirror download.
2) do not "git clone" for the not able to fecth package on request job.

Change-Id: I54a40c60af88607c7ad98e3ed4832d6830d95c5b

job_request.py
job_sync_snapdiff.py

index f0fd064..ce8aa1e 100755 (executable)
@@ -603,6 +603,7 @@ def main():
     except Exception as err:
         print 'Not able to fetch package list from OBS %s' % err
         event_fields['packages'] = []
+        return 0
 
     for var in ['targetproject', 'sourceproject',
                   'comment', 'sender']:
index 35384cf..7234c49 100755 (executable)
@@ -34,7 +34,7 @@ import snapdiff
 
 from common.buildtrigger import trigger_info
 from common.utils import sync
-
+from common.buildtrigger import trigger_next
 
 def search_last_build(build_url, release_name, released=False):
     """Search the lastest build in build_url.
@@ -145,6 +145,7 @@ def main():
     url_pub_base = content[0]['url_pub_base']
     repo_path = content[0]['repo_path']
     build_id = content[0]['buildid']
+    project = content[0]['project']
     # pylint: disable=W0612
     # disable unused variable
     release_name, _release_id = re.search(r'(\S*)_(\d{8}\.\d*)', \
@@ -249,7 +250,12 @@ def main():
             context['images'].pop(item['name'])
 
     # sync all
-    return sync_world('index.html', repo_name, repo_path, snap_diff_name, context)
+    output = sync_world('index.html', repo_name, repo_path, snap_diff_name, context)
+    # TRIGGER NEXT RSYNC-DOWNLOAD (MIRROR)
+    if os.getenv("RSYNC_DOWNLOAD_ENABLED", "0") != "0":
+        trigger_next('RSYNC_DOWNLOAD', {'repo_path': repo_path,
+                                        'project': project})
+    return output
 
 if __name__ == '__main__':
     sys.exit(main())