fix: prepare D518 runtime secret sources
This commit is contained in:
@@ -295,6 +295,13 @@ export interface HwlabRuntimeBootstrapAdminSpec {
|
||||
readonly rolloutDeployment: string;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeCodeAgentProviderSpec {
|
||||
readonly secretName: string;
|
||||
readonly sourceRef: string;
|
||||
readonly openaiSourceKey?: string;
|
||||
readonly opencodeSourceKey?: string;
|
||||
}
|
||||
|
||||
export interface HwlabRuntimeLaneSpec {
|
||||
readonly lane: HwlabRuntimeLane;
|
||||
readonly nodeId: string;
|
||||
@@ -332,6 +339,7 @@ export interface HwlabRuntimeLaneSpec {
|
||||
readonly stepEnv: Record<string, string>;
|
||||
readonly buildkit?: HwlabRuntimeBuildkitSpec;
|
||||
readonly bootstrapAdmin?: HwlabRuntimeBootstrapAdminSpec;
|
||||
readonly codeAgentProvider?: HwlabRuntimeCodeAgentProviderSpec;
|
||||
readonly externalPostgres?: HwlabRuntimeExternalPostgresSpec;
|
||||
readonly runtimeStore?: HwlabRuntimeStoreSpec;
|
||||
readonly webProbe?: HwlabRuntimeWebProbeSpec;
|
||||
@@ -380,6 +388,7 @@ interface HwlabLaneConfig {
|
||||
readonly stepEnv: Record<string, string>;
|
||||
readonly buildkit?: HwlabRuntimeBuildkitSpec;
|
||||
readonly bootstrapAdmin?: HwlabRuntimeBootstrapAdminSpec;
|
||||
readonly codeAgentProvider?: HwlabRuntimeCodeAgentProviderSpec;
|
||||
readonly externalPostgres?: HwlabRuntimeExternalPostgresSpec;
|
||||
readonly runtimeStore?: HwlabRuntimeStoreSpec;
|
||||
readonly webProbe?: HwlabRuntimeWebProbeSpec;
|
||||
@@ -614,6 +623,7 @@ function laneConfig(id: HwlabRuntimeLane, raw: Record<string, unknown>): HwlabLa
|
||||
stepEnv: optionalStringRecord(raw.stepEnv, `lanes.${id}.stepEnv`),
|
||||
buildkit: buildkitConfig(raw.buildkit, `lanes.${id}.buildkit`),
|
||||
bootstrapAdmin: bootstrapAdminConfig(raw.bootstrapAdmin, `lanes.${id}.bootstrapAdmin`),
|
||||
codeAgentProvider: codeAgentProviderConfig(raw.codeAgentProvider, `lanes.${id}.codeAgentProvider`),
|
||||
externalPostgres: externalPostgresConfig(raw.externalPostgres, `lanes.${id}.externalPostgres`),
|
||||
runtimeStore: runtimeStoreConfig(raw.runtimeStore, `lanes.${id}.runtimeStore`),
|
||||
webProbe: webProbeConfig(raw.webProbe, `lanes.${id}.webProbe`),
|
||||
@@ -635,6 +645,7 @@ function laneTargetConfig(id: HwlabRuntimeLane, nodeId: string, baseRaw: Record<
|
||||
stepEnv: mergeOptionalRecord(baseRaw.stepEnv, targetRaw.stepEnv) ?? {},
|
||||
buildkit: mergeOptionalRecord(baseRaw.buildkit, targetRaw.buildkit),
|
||||
bootstrapAdmin: mergeOptionalRecord(baseRaw.bootstrapAdmin, targetRaw.bootstrapAdmin),
|
||||
codeAgentProvider: mergeOptionalRecord(baseRaw.codeAgentProvider, targetRaw.codeAgentProvider),
|
||||
externalPostgres: mergeOptionalRecord(baseRaw.externalPostgres, targetRaw.externalPostgres),
|
||||
runtimeStore: mergeOptionalRecord(baseRaw.runtimeStore, targetRaw.runtimeStore),
|
||||
webProbe: mergeOptionalRecord(baseRaw.webProbe, targetRaw.webProbe),
|
||||
@@ -685,6 +696,22 @@ function bootstrapAdminConfig(value: unknown, path: string): HwlabRuntimeBootstr
|
||||
};
|
||||
}
|
||||
|
||||
function codeAgentProviderConfig(value: unknown, path: string): HwlabRuntimeCodeAgentProviderSpec | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
const raw = asRecord(value, path);
|
||||
const openaiSourceKey = optionalStringField(raw, "openaiSourceKey", path);
|
||||
const opencodeSourceKey = optionalStringField(raw, "opencodeSourceKey", path);
|
||||
if (openaiSourceKey === undefined && opencodeSourceKey === undefined) {
|
||||
throw new Error(`${path} must declare at least one of openaiSourceKey or opencodeSourceKey`);
|
||||
}
|
||||
return {
|
||||
secretName: stringField(raw, "secretName", path),
|
||||
sourceRef: sourceRefField(raw, "sourceRef", path),
|
||||
...(openaiSourceKey === undefined ? {} : { openaiSourceKey: secretKeyField(raw, "openaiSourceKey", path) }),
|
||||
...(opencodeSourceKey === undefined ? {} : { opencodeSourceKey: secretKeyField(raw, "opencodeSourceKey", path) }),
|
||||
};
|
||||
}
|
||||
|
||||
function externalPostgresComponentConfig(value: unknown, path: string): HwlabRuntimeExternalPostgresComponentSpec {
|
||||
const raw = asRecord(value, path);
|
||||
return {
|
||||
@@ -1239,6 +1266,7 @@ function buildRuntimeLaneSpec(config: HwlabLaneConfig): HwlabRuntimeLaneSpec {
|
||||
stepEnv: config.stepEnv,
|
||||
...(config.buildkit === undefined ? {} : { buildkit: config.buildkit }),
|
||||
...(config.bootstrapAdmin === undefined ? {} : { bootstrapAdmin: config.bootstrapAdmin }),
|
||||
...(config.codeAgentProvider === undefined ? {} : { codeAgentProvider: config.codeAgentProvider }),
|
||||
...(config.externalPostgres === undefined ? {} : { externalPostgres: config.externalPostgres }),
|
||||
...(config.runtimeStore === undefined ? {} : { runtimeStore: config.runtimeStore }),
|
||||
...(config.webProbe === undefined ? {} : { webProbe: config.webProbe }),
|
||||
|
||||
Reference in New Issue
Block a user