diff options
author | Tim Rozet <trozet@redhat.com> | 2018-03-20 20:36:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-03-20 20:36:56 +0000 |
commit | 98943957eb362079364925be89adf0312629cf3a (patch) | |
tree | 069da831478e6900f9486a437a6d856a19d34e26 /jjb/apex | |
parent | 82bc3cf5f732a053175533acf5fc105a81a63681 (diff) | |
parent | 434509e22a2ce3578e226bcaa68d4d2b4ceece2b (diff) |
Merge "Make Apex JJB Renderer Importable"
Diffstat (limited to 'jjb/apex')
-rw-r--r-- | jjb/apex/apex-jjb-renderer.py | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/jjb/apex/apex-jjb-renderer.py b/jjb/apex/apex-jjb-renderer.py index 6fd83afe9..b67784376 100644 --- a/jjb/apex/apex-jjb-renderer.py +++ b/jjb/apex/apex-jjb-renderer.py @@ -12,30 +12,38 @@ import yaml from jinja2 import Environment from jinja2 import FileSystemLoader -gspathname = dict() -branch = dict() -build_slave = dict() -env = Environment(loader=FileSystemLoader('./'), autoescape=True) -with open('scenarios.yaml.hidden') as _: - scenarios = yaml.safe_load(_) +def render_jjb(): + """Render JJB output from scenarios.yaml.hidden file and jinja + template""" -template = env.get_template('apex.yml.j2') + gspathname = dict() + branch = dict() + build_slave = dict() + env = Environment(loader=FileSystemLoader('./'), autoescape=True) -print("Scenarios are: ") -pprint.pprint(scenarios) + with open('scenarios.yaml.hidden') as _: + scenarios = yaml.safe_load(_) -for stream in scenarios: - if stream == 'master': - gspathname['master'] = '' - branch[stream] = stream - else: - gspathname[stream] = '/' + stream - branch[stream] = 'stable/' + stream - build_slave[stream] = 'apex-baremetal-{}'.format(stream) + template = env.get_template('apex.yml.j2') -output = template.render(scenarios=scenarios, gspathname=gspathname, - branch=branch, build_slave=build_slave) + print("Scenarios are: ") + pprint.pprint(scenarios) -with open('./apex.yml', 'w') as fh: - fh.write(output) + for stream in scenarios: + if stream == 'master': + gspathname['master'] = '' + branch[stream] = stream + else: + gspathname[stream] = '/' + stream + branch[stream] = 'stable/' + stream + build_slave[stream] = 'apex-baremetal-{}'.format(stream) + + output = template.render(scenarios=scenarios, gspathname=gspathname, + branch=branch, build_slave=build_slave) + + with open('./apex.yml', 'w') as fh: + fh.write(output) + +if __name__ == "__main__": + render_jjb() |