From 96181756e748a08f8fd605a54df29e7cf5fc4ec8 Mon Sep 17 00:00:00 2001 From: Yonghee Han Date: Mon, 16 Apr 2018 18:43:39 +0900 Subject: [PATCH] Add a mailing list for the profiles. Change how to get the profiles from code to configuration file. Change-Id: I8e12ca2792fbeb8a8b122e218695fdabf014dc51 --- job_create_sdkrootstrap.py | 77 +++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 53 deletions(-) diff --git a/job_create_sdkrootstrap.py b/job_create_sdkrootstrap.py index d881f49..74456e3 100755 --- a/job_create_sdkrootstrap.py +++ b/job_create_sdkrootstrap.py @@ -22,6 +22,7 @@ import urllib2 import codecs import base64 import json +import ast from urllib import quote_plus from common.buildtrigger import trigger_info, trigger_next, remote_jenkins_build_job @@ -48,55 +49,6 @@ EMAIL_FOOTER = '\n\n--------------------------------------------------------\n'\ EMAIL_CONTENT=[] -profiles = [ - {'name': '3.0-mobile', - 'project': 'Tizen:3.0:Mobile', - 'base_url': os.getenv('RBS_BASE_URL'), - 'base_repo_path': 'public_mirror/tizen/3.0-base', - 'repo_path': 'public_mirror/tizen/3.0-mobile', - 'git_rs_prj': 'sdk/tools/sdk-image', - 'public_cmd': 'rs_snapshot_public', - 'private_cmd': 'rs_snapshot', - 'git_branch': 'platform_3.0'}, - {'name': '3.0-wearable', - 'project': 'Tizen:3.0:Wearable', - 'base_url': os.getenv('RBS_BASE_URL'), - 'base_repo_path': 'public_mirror/tizen/3.0-base', - 'repo_path': 'public_mirror/tizen/3.0-wearable', - 'git_rs_prj': 'sdk/tools/sdk-image', - 'public_cmd': 'rs_snapshot_public', - 'private_cmd': 'rs_snapshot', - 'git_branch': 'platform_3.0'}, - {'name': 'tizen-unified', - 'project': 'Tizen:Unified', - 'base_url': os.getenv('RBS_BASE_URL'), - 'base_repo_path': 'public_mirror/tizen/base', - 'repo_path': 'public_mirror/tizen/unified', - 'git_rs_prj': 'sdk/tools/sdk-image', - 'public_cmd': 'rs_rbs_public', - 'private_cmd': 'rs_rbs_private', - 'git_branch': 'platform_5.0', - 'misc_branches': ['tizen_mde']}, - {'name': '4.0-unified', - 'project': 'Tizen:4.0:Unified', - 'base_url': os.getenv('RBS_BASE_URL'), - 'base_repo_path': 'public_mirror/tizen/4.0-base', - 'repo_path': 'public_mirror/tizen/4.0-unified', - 'git_rs_prj': 'sdk/tools/sdk-image', - 'public_cmd': 'rs_rbs_public', - 'private_cmd': 'rs_rbs_private', - 'git_branch': 'platform_4.0'}, - {'name': 'tizen-4.0-mcd-z4', - 'project': 'Tizen:4.0:MCD:Z4', - 'base_url': os.getenv('RBS_BASE_URL'), - 'base_repo_path': 'snapshots/tizen/4.0-base-mcd-z4/', - 'repo_path': 'snapshots/tizen/4.0-mcd-z4/', - 'git_rs_prj': 'sdk/tools/sdk-image', - 'public_cmd': 'rs_rbs_public', - 'private_cmd': 'rs_rbs_product', - 'git_branch': 'tizen_MCD_Z4'}, - ] - profile = None class LocalError(Exception): @@ -104,6 +56,13 @@ class LocalError(Exception): pass def setup_profile(project): + """ Setup profile """ + + if os.getenv('RBS_PROFILES'): + profiles = ast.literal_eval(os.getenv('RBS_PROFILES')) + else: + return False + # set up profile for l in profiles: if project == l['project']: @@ -330,8 +289,14 @@ def make_rs_snapshot_private(git_prj, git_cache, mygit, fields, profile, vm_imag basesnapshot_url, sdkrootstrap_url, status) - recevier = { 'author' : 'RBS Administrator', - 'email' : os.getenv('RBS_MAILINGLIST') } + + if profile.get('mailing_list'): + recevier = { 'author' : 'RBS Administrator', + 'email' : profile.get('mailing_list') } + else: + recevier = { 'author' : 'RBS Administrator', + 'email' : os.getenv('RBS_MAILINGLIST') } + if recevier: send_mail(title, msg, recevier) @@ -450,8 +415,14 @@ def make_rs_snapshot_public(git_prj, git_cache, mygit, fields, profile, vm_image basesnapshot_url, sdkrootstrap_url, status) - recevier = { 'author' : 'RBS Administrator', - 'email' : os.getenv('RBS_MAILINGLIST') } + + if profile.get('mailing_list'): + recevier = { 'author' : 'RBS Administrator', + 'email' : profile.get('mailing_list') } + else: + recevier = { 'author' : 'RBS Administrator', + 'email' : os.getenv('RBS_MAILINGLIST') } + if recevier: send_mail(title, msg, recevier) -- 2.7.4