ymal: compose repeated node lane templates
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { rootPath } from "./config";
|
||||
import { materializeYamlComposition } from "./yaml-composition";
|
||||
|
||||
export interface WebProbeSentinelTemplateContext {
|
||||
readonly nodeId: string;
|
||||
@@ -34,7 +35,7 @@ export function readWebProbeSentinelConfigRef(context: WebProbeSentinelTemplateC
|
||||
const absPath = rootPath(parsed.file);
|
||||
if (!existsSync(absPath)) throw new Error(`${parsed.file} does not exist`);
|
||||
const text = readFileSync(absPath, "utf8");
|
||||
const doc = Bun.YAML.parse(text) as unknown;
|
||||
const doc = materializeYamlComposition(Bun.YAML.parse(text) as unknown, { label: parsed.file }).value;
|
||||
const vars = { ...builtinVars, ...documentVars(doc, builtinVars) };
|
||||
const path = renderTemplateString(parsed.path, vars, `${parsed.file}#path`);
|
||||
const target = valueAtConfigPath(doc, path);
|
||||
|
||||
Reference in New Issue
Block a user