fix: rewrite D601 runtime GitOps images
This commit is contained in:
@@ -85,6 +85,11 @@ export interface HwlabRuntimeObservabilitySpec {
|
||||
readonly prometheusOperator: boolean;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeImageRewriteSpec {
|
||||
readonly source: string;
|
||||
readonly target: string;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeLaneSpec {
|
||||
readonly lane: HwlabRuntimeLane;
|
||||
readonly nodeId: string;
|
||||
@@ -123,6 +128,7 @@ export interface HwlabRuntimeLaneSpec {
|
||||
readonly buildkit?: HwlabRuntimeBuildkitSpec;
|
||||
readonly externalPostgres?: HwlabRuntimeExternalPostgresSpec;
|
||||
readonly observability: HwlabRuntimeObservabilitySpec;
|
||||
readonly runtimeImageRewrites: readonly HwlabRuntimeImageRewriteSpec[];
|
||||
readonly networkProfileId: string;
|
||||
readonly downloadProfileId: string;
|
||||
readonly networkProfile: HwlabNetworkProfileSpec;
|
||||
@@ -161,6 +167,7 @@ interface HwlabLaneConfig {
|
||||
readonly buildkit?: HwlabRuntimeBuildkitSpec;
|
||||
readonly externalPostgres?: HwlabRuntimeExternalPostgresSpec;
|
||||
readonly observability: HwlabRuntimeObservabilitySpec;
|
||||
readonly runtimeImageRewrites: readonly HwlabRuntimeImageRewriteSpec[];
|
||||
}
|
||||
|
||||
interface HwlabNodeLaneConfig {
|
||||
@@ -359,6 +366,7 @@ function laneConfig(id: HwlabRuntimeLane, raw: Record<string, unknown>): HwlabLa
|
||||
buildkit: buildkitConfig(raw.buildkit, `lanes.${id}.buildkit`),
|
||||
externalPostgres: externalPostgresConfig(raw.externalPostgres, `lanes.${id}.externalPostgres`),
|
||||
observability: observabilityConfig(raw.observability, `lanes.${id}.observability`),
|
||||
runtimeImageRewrites: runtimeImageRewritesConfig(raw.runtimeImageRewrites, `lanes.${id}.runtimeImageRewrites`),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -426,6 +434,18 @@ function observabilityConfig(value: unknown, path: string): HwlabRuntimeObservab
|
||||
};
|
||||
}
|
||||
|
||||
function runtimeImageRewritesConfig(value: unknown, path: string): HwlabRuntimeImageRewriteSpec[] {
|
||||
if (value === undefined) return [];
|
||||
if (!Array.isArray(value)) throw new Error(`${path} must be an array`);
|
||||
return value.map((item, index) => {
|
||||
const raw = asRecord(item, `${path}[${index}]`);
|
||||
return {
|
||||
source: stringField(raw, "source", `${path}[${index}]`),
|
||||
target: stringField(raw, "target", `${path}[${index}]`),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function readHwlabNodeLaneConfig(): HwlabNodeLaneConfig {
|
||||
const path = rootPath(HWLAB_NODE_LANE_CONFIG_PATH);
|
||||
const raw = readFileSync(path, "utf8");
|
||||
@@ -508,6 +528,7 @@ function buildRuntimeLaneSpec(config: HwlabLaneConfig): HwlabRuntimeLaneSpec {
|
||||
...(config.buildkit === undefined ? {} : { buildkit: config.buildkit }),
|
||||
...(config.externalPostgres === undefined ? {} : { externalPostgres: config.externalPostgres }),
|
||||
observability: config.observability,
|
||||
runtimeImageRewrites: config.runtimeImageRewrites,
|
||||
networkProfileId: networkProfile.id,
|
||||
downloadProfileId: downloadProfile.id,
|
||||
networkProfile,
|
||||
|
||||
Reference in New Issue
Block a user