Commit 7b3d322e authored by Peter Hutterer's avatar Peter Hutterer
Browse files

defaults.yml: split up into a globals.yml and an example file



Now that there's nothing left to be rendered in the defaults.yml file,
we no longer need that section. Move it to an example file for documentation
and move the global variables into their own section.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 42e9896c
## This is the defaults file, that will be merged with the distribution
## specific YAML.
##
## Given that each distribution might have different default values, this
## file is also processed by jinja before merging with the distribution
## configuration
##
## This file lists the possible keys supported for a distribution-specific
## YAML file.
## The root level entry must be unique, but not necesseraly tied to a
## distribution. Each root level entry will generate a new template in
## the `templates` folder.
##
## Special cases:
## - `defaults`: this defines the defautl values for the templates
## - `globals`: some global definitions
defaults:
example:
## @distribution: The distribution name
##
## Each template will be given the `{distribution}.yml` name
......@@ -77,37 +69,11 @@ defaults:
aarch64: false
## @qemu: qemu-specific configuration
#
# Note: this is commented out to not evaluate as True
#
#qemu:
##
qemu:
## @qemu.packages: list of packages that are required on a base qemu image
##
## if this variable is not defined, the matching qemu template will not
## be generated
#
# Note: this is commented out to not evaluate as True
#packages: []
globals:
## @scripts: list of scripts to be tested against in CI
##
## distros should not overwrite this list, it has a special global meaning
scripts:
- '.hidden_dir/test.sh /test_file'
- '/bin/bash test/script.sh'
- './test/script.sh'
- 'sh test/script.sh'
## @bootstrap_tag: the current image tag associated with this bootstrap image
bootstrap_tag: '2020-10-30.1'
## @qemu_tag: the current image tag associated with this qemu bootstrap image
qemu_tag: '2020-10-30.1'
## @ci_templates_registry_path: the path to where the templates should look
## for bootstrap images.
ci_templates_registry: 'quay.io'
ci_templates_registry_path: '/freedesktop.org/ci-templates'
packages: []
......@@ -15,12 +15,10 @@ if __name__ == '__main__':
# load the various definitions in the provided YAML files
src_folder = Path('src')
with open(src_folder / 'globals.yml') as fd:
globs = yaml.load(fd, Loader=yaml.Loader)['globals']
defaults_template = env.get_template('defaults.yml')
globs = yaml.load(defaults_template.render({}),
Loader=yaml.Loader)['globals']
special_files = ('defaults.yml')
special_files = ('globals.yml')
for distrib in [x for x in src_folder.iterdir()
if (x.name.endswith('.yml') and x.name not in special_files)]:
with open(distrib) as fd:
......@@ -38,15 +36,6 @@ if __name__ == '__main__':
if 'VERSION' in config:
del(config['VERSION'])
# render the defaults template with the current root element
defaults = yaml.load(defaults_template.render(config),
Loader=yaml.Loader)['defaults']
# add missing keys from the generated defaults
for key, value in defaults.items():
if key not in config:
config[key] = value
# add missing keys from the globals
for key, value in globs.items():
if key not in config:
......
globals:
## @scripts: list of scripts to be tested against in CI
##
## distros should not overwrite this list, it has a special global meaning
scripts:
- '.hidden_dir/test.sh /test_file'
- '/bin/bash test/script.sh'
- './test/script.sh'
- 'sh test/script.sh'
## @bootstrap_tag: the current image tag associated with this bootstrap image
bootstrap_tag: '2020-10-30.1'
## @qemu_tag: the current image tag associated with this qemu bootstrap image
qemu_tag: '2020-10-30.1'
## @ci_templates_registry_path: the path to where the templates should look
## for bootstrap images.
ci_templates_registry: 'quay.io'
ci_templates_registry_path: '/freedesktop.org/ci-templates'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment