Made repo root available for templates

This allows for embedding the repo root inside of, for example, scripts
to make them function properly no matter where they are run from.
This commit is contained in:
2025-11-09 03:03:09 +01:00
parent 81e861ef14
commit ea3d1bf0fa
2 changed files with 4 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
ROOT=$(git rev-parse --show-toplevel) ROOT={{ root }}
CONFIGS=${ROOT}/configs CONFIGS=${ROOT}/configs
# Generate the configuration for each node # Generate the configuration for each node

View File

@@ -152,7 +152,9 @@ def main():
for template_name in TEMPLATES.list_templates(): for template_name in TEMPLATES.list_templates():
template = TEMPLATES.get_template(template_name) template = TEMPLATES.get_template(template_name)
rendered = template.render(nodes=nodes, clusters=clusters, config=config) rendered = template.render(
nodes=nodes, clusters=clusters, config=config, root=ROOT
)
with open(RENDERED.joinpath(template_name), "w") as f: with open(RENDERED.joinpath(template_name), "w") as f:
f.write(rendered) f.write(rendered)