Last active
October 11, 2019 08:29
-
-
Save octavian-nita/58b6612ace2267d0ed39e3476e7056e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from os import path, makedirs | |
from string import Template | |
if __name__ == '__main__': | |
def generate_config_xml(job, template, mapping, **kwds): | |
print("\nGenerating Jenkins job config file in %s..." % job) | |
makedirs(job, exist_ok=True) | |
with open(path.join(job, 'config.xml'), 'w') as f: | |
print(Template(template).substitute(mapping, **kwds), file=f) | |
inc_modules = {'core', 'webapi', 'client'} | |
exc_modules = {'client'} | |
base_dir = path.dirname(path.realpath(__file__)) | |
conf_dir = path.join(base_dir, 'config') | |
m_prefix = '' | |
with open(path.join(base_dir, 'config-module.xml')) as f: | |
conf_tpl_module = f.read() | |
with open(path.join(base_dir, 'config-module-release.xml')) as f: | |
conf_tpl_modrel = f.read() | |
for m in sorted(inc_modules - exc_modules): | |
mapping = {'module': m} | |
generate_config_xml(path.join(conf_dir, '%s%s' % (m_prefix, m)), | |
conf_tpl_module, mapping) | |
generate_config_xml(path.join(conf_dir, '%s%s-release' % (m_prefix, m)), | |
conf_tpl_modrel.replace('-Dmaven.test.skip=true', '-Dmaven.test.skip.exec=true') \ | |
if m == 'process-impl' else conf_tpl_modrel, | |
mapping) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment