Merge "Allow Asynchronous Apex Builds"
[releng.git] / jjb / apex / apex-jjb-renderer.py
1 ##############################################################################
2 # Copyright (c) 2016 Tim Rozet (trozet@redhat.com) and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 import pprint
11 import yaml
12 from jinja2 import Environment
13 from jinja2 import FileSystemLoader
14
15 gspathname = dict()
16 branch = dict()
17 env = Environment(loader=FileSystemLoader('./'), autoescape=True)
18
19 with open('scenarios.yaml.hidden') as _:
20     scenarios = yaml.safe_load(_)
21
22 template = env.get_template('apex.yml.j2')
23
24 print("Scenarios are: ")
25 pprint.pprint(scenarios)
26
27 for stream in scenarios:
28     if stream == 'master':
29         gspathname['master'] = ''
30         branch[stream] = stream
31     else:
32         gspathname[stream] = '/' + stream
33         branch[stream] = 'stable/' + stream
34
35 output = template.render(scenarios=scenarios, gspathname=gspathname,
36                          branch=branch)
37
38 with open('./apex.yml', 'w') as fh:
39     fh.write(output)