fix(workbench): make trace disclosure lifecycle configurable

This commit is contained in:
lyon
2026-06-19 00:16:30 +08:00
parent 8f11fef91e
commit 42685be15b
11 changed files with 169 additions and 27 deletions
+21
View File
@@ -962,6 +962,20 @@ function serviceDeclarationEnvForProfile(deploy, profile, serviceId) {
return cloneJson(env);
}
function runtimeWorkbenchTraceTimelinePolicy(deploy, profile) {
if (!isRuntimeLane(profile)) return null;
const traceTimeline = runtimeLaneConfig(deploy, profile)?.workbench?.traceTimeline;
if (!traceTimeline || typeof traceTimeline !== "object" || Array.isArray(traceTimeline)) return null;
const result = {};
if (typeof traceTimeline.autoExpandRunning === "boolean") result.autoExpandRunning = traceTimeline.autoExpandRunning;
if (typeof traceTimeline.autoCollapseTerminal === "boolean") result.autoCollapseTerminal = traceTimeline.autoCollapseTerminal;
return Object.keys(result).length > 0 ? result : null;
}
function booleanEnv(value) {
return value ? "1" : "0";
}
function mergeEnvMaps(...values) {
const result = {};
for (const value of values) {
@@ -1188,6 +1202,13 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
if (serviceId === "hwlab-cloud-web") {
upsertEnv(container.env, "HWLAB_API_BASE_URL", `http://hwlab-cloud-api.${namespace}.svc.cluster.local:6667`);
upsertEnv(container.env, "HWLAB_PUBLIC_ENDPOINT", webEndpoint);
const traceTimelinePolicy = runtimeWorkbenchTraceTimelinePolicy(deploy, profile);
if (typeof traceTimelinePolicy?.autoExpandRunning === "boolean") {
upsertEnv(container.env, "HWLAB_WORKBENCH_TRACE_AUTO_EXPAND_RUNNING", booleanEnv(traceTimelinePolicy.autoExpandRunning));
}
if (typeof traceTimelinePolicy?.autoCollapseTerminal === "boolean") {
upsertEnv(container.env, "HWLAB_WORKBENCH_TRACE_AUTO_COLLAPSE_TERMINAL", booleanEnv(traceTimelinePolicy.autoCollapseTerminal));
}
}
}
rewritePodSecretRefs(podTemplate.spec, profile);