From b33f3a5ff3c20083eab16c6af9afc695aab361c8 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Fri, 21 Mar 2014 01:53:27 +0200 Subject: [PATCH] job_submit: Added commit id and submitter to meta Repa will add commit id and submitter to SR, which is requested by release engineers in this bug: https://bugs.tizen.org/jira/browse/TINF-468 Fixes: #1679 Fixes: #TINF-468 Change-Id: I3c6e578eafc5f1c0e7e3194b27511fbc87d5a455 Signed-off-by: Ed Bartosh --- job_submit.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/job_submit.py b/job_submit.py index 98d9058..95696f2 100755 --- a/job_submit.py +++ b/job_submit.py @@ -51,14 +51,17 @@ def git_obs_map(gerrit_prj, gerrit_branch): (gerrit_prj, gerrit_branch)) def create_project(git_url, git_project, git_tag, git_revision, build, - obs_target_prj, obs_project): + obs_target_prj, obs_project, submitter): """Create prerelease OBS project and upload sources for the build.""" # Create review project if it doesn't exist print "Creating temporary review OBS project %s" % obs_project info = {'projects': [git_project], 'obs_target_prj': obs_target_prj, - 'git_tag': git_tag} + 'git_tag': git_tag, + 'git_commit': git_revision} + if submitter: + info['submitter'] = submitter if build.exists(obs_project): # update project info @@ -98,6 +101,8 @@ def main(build_type): gerrit_refname = os.getenv("GERRIT_REFNAME") gerrit_oldrev = os.getenv("GERRIT_OLDREV") gerrit_newrev = os.getenv("GERRIT_NEWREV") + gerrit_account_name = os.getenv("GERRIT_EVENT_ACCOUNT_NAME") + gerrit_account_email = os.getenv("GERRIT_EVENT_ACCOUNT_EMAIL") # Init backend database redis_host = os.getenv("REDIS_HOST") @@ -124,8 +129,13 @@ def main(build_type): if is_ref_deleted(gerrit_oldrev, gerrit_newrev): build.cleanup(project, "Cleaned by %s" % name) else: + submitter = '' + if gerrit_account_name: + submitter = gerrit_account_name + if gerrit_account_email: + submitter += ' <%s>' % gerrit_account_email create_project(url, gerrit_project, git_tag, gerrit_newrev, - build, obs_target_prj, project) + build, obs_target_prj, project, submitter) elif build_type == 'snapshot': if not is_ref_deleted(gerrit_oldrev, gerrit_newrev): if build.exists(obs_target_prj): -- 2.7.4