From: hyokeun Date: Fri, 18 Aug 2017 04:25:46 +0000 (+0900) Subject: TPE-193 Prepare SR Sync data along with commit id and submitter X-Git-Tag: submit/trunk/20190927.012743~320^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F03%2F144803%2F2;p=services%2Fjenkins-scripts.git TPE-193 Prepare SR Sync data along with commit id and submitter Change-Id: I176567b5ad545a81fcfcd6d240c57cedcf5dfbda --- diff --git a/job_buildmonitor.py b/job_buildmonitor.py index 00c3b56..04cc3ee 100644 --- a/job_buildmonitor.py +++ b/job_buildmonitor.py @@ -2184,28 +2184,33 @@ def main(): bm_src_project_lst) ### 2. bm_member_git_tag_list (sr_status + sr_commit) - for each_request in bm_member_sr_info['requests']: - print ' snapshot:%s' % each_request['snapshot'] + for each_project in bm_member_sr_info: + print ' tester_project: %s' % each_project print ' submit_list:' - for each_sr_info in each_request['submit_list']: - each_git_tag = each_sr_info.keys()[0] - print ' %s' % each_git_tag + for item in bm_member_sr_info[each_project]: + _sr = item.get('git_tag') + _cid = item.get('cid') + _submitter = item.get('submitter') + _project = item.get('gerrit_project') + _package = item.get('package') + print ' SR:%s' % item.get('git_tag') + print ' CID:%s' % item.get('cid') + print ' SUBMITTER:%s' % item.get('submitter') + print ' PROJECT:%s' % item.get('gerrit_project') + print ' PACKAGE:%s' % item.get('package') # member_sr for [sr_status] table - sync_sr_submit_for_sr_status(each_git_tag) + sync_sr_submit_for_sr_status(_sr) # member sr & sync_sr for [sync_sr_map] table - sync_sr_submit_for_sync_sr_map(bm_sync_git_tag, each_git_tag) - - for each_git_path in each_sr_info[each_sr_info.keys()[0]]: - print ' %s' % each_git_path # replace gerrit_project - # member sr for [sr_commit] - sync_sr_submit_for_sr_commit(commit_date, commit_msg, - submit_date, submit_msg, - submitter, each_git_tag, - each_git_path, gerrit_newrev, - gerrit_account_name) - + sync_sr_submit_for_sync_sr_map(bm_sync_git_tag, _sr) + + # member sr for [sr_commit] + sync_sr_submit_for_sr_commit(commit_date, commit_msg, + submit_date, submit_msg, + submitter, _sr, + _project, gerrit_newrev, + gerrit_account_name) #update_sr_submit_log_completed(git_tag) diff --git a/job_submit_request_sync.py b/job_submit_request_sync.py index 636de84..ddbe7d7 100644 --- a/job_submit_request_sync.py +++ b/job_submit_request_sync.py @@ -77,8 +77,13 @@ def request_sr_list_for_snapshot(project, snapshot, reason): continue print sr_list_from_snapshot sr_list = [] + for sr in sr_list_from_snapshot: - sr_list.append({sr.get('sr'): [ x.get('repo') for x in sr.get('packages') ]}) + for index, item in enumerate(sr.get('packages')): + sr_list.append({sr.get('sr'): [ {'repo': item.get('repo'), + 'cid': item.get('cid'), + 'submitter': sr.get('submitters')[index]} + ]}) ret_data['requests'].append({'snapshot': snapshot, 'submit_list': sr_list}) return ret_data @@ -187,7 +192,10 @@ def main(): for sr in rq['submit_list']: _sr_tag = sr.keys()[0] _sr_list = {_sr_tag: []} - for repo in sr[_sr_tag]: + for item in sr[_sr_tag]: + repo = item.get('repo') + cid = item.get('cid') + smtr = item.get('submitter') bSetHighlight = True for item in mapping: # We only care about defined git repositories @@ -195,9 +203,9 @@ def main(): item.get('Project_name', '') == target_fork_prefix + repo: bSetHighlight = False if bSetHighlight: - marked_repo = HIGHLIGHT + repo + marked_repo = {'repo': HIGHLIGHT + repo, 'cid': cid, 'submitter': smtr} else: - marked_repo = GREYEDOUT + repo + marked_repo = {'repo': GREYEDOUT + repo, 'cid': cid, 'submitter': smtr} if marked_repo not in _sr_list[_sr_tag]: _sr_list[_sr_tag].append(marked_repo) if _sr_list[_sr_tag]: @@ -212,13 +220,18 @@ def main(): % (req['snapshot'], [ x.keys()[0] for x in req['submit_list'] ]) for sr in req['submit_list']: for submit in sr.keys(): - for git in sr[submit]: + for item in sr[submit]: + git = item.get('repo') + cid = item.get('cid') + smtr = item.get('submitter') _package = '' if git.startswith(HIGHLIGHT): _package = get_obs_package_name(git[1:], source_branch, project, \ submit, GerritEnv('PUBLIC_')) requests_item[project_to_create].append({'package': _package, \ 'git_tag': submit, \ + 'cid': cid, \ + 'submitter': smtr, \ 'gerrit_project': git}) if True: #os.getenv('label') == 'SR-SYNC': @@ -226,6 +239,7 @@ def main(): {'requests': [requests_item], \ 'obs_target_prj': project, \ 'url': git_url, \ + 'obs_dest_prj': target['target'], \ 'reason': reason}) bm_end_datetime = datetime.now() @@ -237,7 +251,7 @@ def main(): "submit_date" : str(bm_end_datetime), "submit_msg" : "N/A", "submitter" : "", - "bm_member_sr_info" : ret_data, + "bm_member_sr_info" : requests_item, "bm_sync_git_tag" : bm_sync_git_tag, "gerrit_project" : "N/A", "gerrit_newrev" : "N/A",