provisioning-catalog/components/lian_build/cluster/vars.nu

24 lines
801 B
Text

#!/usr/bin/env nu
# Derived variables for lian_build bundle rendering.
#
# - CONTEXT_SRC_DIRS: space-joined list for the siblings ctx_type branch in install.sh.tmpl
# - SECRETS_BASE: workspace root from LIAN_BUILD_WORKSPACE_ROOT env when available,
# overrides the NCL value so secrets_base never needs to be hardcoded in build NCL files
def main [component_json: string]: nothing -> nothing {
let d = ($component_json | from json)
let dirs = ($d | get -o context_src_dirs | default [])
let secrets_base = if "LIAN_BUILD_WORKSPACE_ROOT" in $env {
$env.LIAN_BUILD_WORKSPACE_ROOT
} else {
$d | get -o secrets_base | default ""
}
{
CONTEXT_SRC_DIRS: ($dirs | str join " "),
SECRETS_BASE: $secrets_base,
}
| to json --raw
| print
}