From 0e7fab67d84b4cc9a9e65a4bd4b8e9cfcca51f46 Mon Sep 17 00:00:00 2001 From: Hyokeun Jeon Date: Wed, 26 Jun 2019 09:49:20 +0900 Subject: [PATCH] Fix of wrong triggers for sr sync Change-Id: I7cf629b4b1b7c031a252371e42e677527dbfc770 --- job_submit_request_sync.py | 71 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/job_submit_request_sync.py b/job_submit_request_sync.py index eb6cb80..cbda7bc 100644 --- a/job_submit_request_sync.py +++ b/job_submit_request_sync.py @@ -300,42 +300,41 @@ def main(): # Split request into smaller part split_step = 100 for r in xrange(0, len(requests_item[project_to_create]), split_step): - if target.get('sr-sync') != 'Yes': continue - trigger_next('PRE_RELEASE_REQUEST_%s_%d' % (target['target'], (r/split_step)+1), \ - {'requests': [{project_to_create: requests_item[project_to_create][r:(r+split_step)]}], \ - 'obs_target_prj': project, \ - 'url': git_url, \ - 'obs_dest_prj': target['target'], \ - 'reason': reason, \ - 'snapshot': snapshot, \ - 'sync_user' : triggered_by, \ - 'index_sequence': '%d-%d' % ((r/split_step)+1, len(requests_item[project_to_create]))}) - - for file_name in os.listdir(os.getenv('WORKSPACE')): - full_path = os.path.join(os.getenv('WORKSPACE'), file_name) - dest_path = os.path.join(os.getenv('WORKSPACE'), 'SR_SYNC_' + file_name) - if (os.path.isfile(full_path) and file_name.startswith('PRE_RELEASE_REQUEST_') and file_name.endswith('.env')): - copyfile(full_path, dest_path) - - bm_end_datetime = datetime.now() - bm_sync_git_tag = project_to_create.split(':'+target['target']+':')[-1].replace(':','/') - bm_stage = "Sync_SR_Submit" - bm_data = {"bm_stage" : bm_stage, - "commit_date" : str(bm_end_datetime), - "commit_msg" : "N/A", - "submit_date" : str(bm_end_datetime), - "submit_msg" : "N/A", - "submitter" : "<%s>" % triggered_by, - "bm_member_sr_info" : {project_to_create: requests_item[project_to_create][r:(r+split_step)]}, - "bm_sync_git_tag" : bm_sync_git_tag, - "gerrit_project" : "N/A", - "gerrit_newrev" : "N/A", - "gerrit_account_name" : "tizen.build", - "bm_start_datetime": str(bm_start_datetime), - "bm_end_datetime": str(bm_end_datetime), - "bm_src_project_lst": [project_to_create], - } - trigger_next("BUILD-MONITOR_%s_%d" % (bm_stage, r), bm_data) + trigger_data = {'requests': [{project_to_create: requests_item[project_to_create][r:(r+split_step)]}], \ + 'obs_target_prj': project, \ + 'url': git_url, \ + 'obs_dest_prj': target['target'], \ + 'reason': reason, \ + 'snapshot': snapshot, \ + 'sync_user' : triggered_by, \ + 'index_sequence': '%d-%d' % ((r/split_step)+1, len(requests_item[project_to_create]))} + + if target.get('git-sync') == 'Yes': + trigger_next('PRE_RELEASE_REQUEST_%s_%d' % (target['target'], (r/split_step)+1), \ + trigger_data) + if target.get('sr-sync') == 'Yes': + trigger_next('SR_SYNC_PRE_RELEASE_REQUEST_%s_%d' % (target['target'], (r/split_step)+1), \ + trigger_data) + + bm_end_datetime = datetime.now() + bm_sync_git_tag = project_to_create.split(':'+target['target']+':')[-1].replace(':','/') + bm_stage = "Sync_SR_Submit" + bm_data = {"bm_stage" : bm_stage, + "commit_date" : str(bm_end_datetime), + "commit_msg" : "N/A", + "submit_date" : str(bm_end_datetime), + "submit_msg" : "N/A", + "submitter" : "<%s>" % triggered_by, + "bm_member_sr_info" : {project_to_create: requests_item[project_to_create][r:(r+split_step)]}, + "bm_sync_git_tag" : bm_sync_git_tag, + "gerrit_project" : "N/A", + "gerrit_newrev" : "N/A", + "gerrit_account_name" : "tizen.build", + "bm_start_datetime": str(bm_start_datetime), + "bm_end_datetime": str(bm_end_datetime), + "bm_src_project_lst": [project_to_create], + } + trigger_next("BUILD-MONITOR_%s_%s_%d" % (bm_stage, target['target'], r), bm_data) # Mail notification if False: -- 2.7.4