fix: track gitops render source in runtime readiness

This commit is contained in:
lyon
2026-06-17 22:41:41 +08:00
parent c5aee420a0
commit 0c474007e5
2 changed files with 10 additions and 2 deletions
+9 -1
View File
@@ -1038,11 +1038,13 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
label(item.metadata, {
...stableRuntimeLabels,
"hwlab.pikastech.local/gitops-target": gitopsTarget,
"hwlab.pikastech.local/gitops-render-source-commit": source.full,
"hwlab.pikastech.local/source-commit": source.full,
"unidesk.ai/node-staging": profile === "dev" ? "true" : "false"
});
annotate(item.metadata, {
"hwlab.pikastech.local/gitops-note": profile === "v02" ? "HWLAB v0.2 GitOps target." : profile === "prod" ? "node PROD GitOps target." : "node DEV GitOps target.",
"hwlab.pikastech.local/gitops-render-source-commit": source.full,
"hwlab.pikastech.local/source-commit": source.full
});
if (item.kind === "Job") {
@@ -1064,6 +1066,7 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
label(podTemplate.metadata ??= {}, {
...stableRuntimeLabels,
"hwlab.pikastech.local/gitops-target": gitopsTarget,
"hwlab.pikastech.local/gitops-render-source-commit": source.full,
"hwlab.pikastech.local/source-commit": templateSourceCommit,
"hwlab.pikastech.local/artifact-source-commit": templateArtifactCommit
});
@@ -1080,6 +1083,7 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
};
}
annotate(podTemplate.metadata, {
"hwlab.pikastech.local/gitops-render-source-commit": source.full,
"hwlab.pikastech.local/source-commit": templateSourceCommit,
"hwlab.pikastech.local/artifact-source-commit": templateArtifactCommit,
"hwlab.pikastech.local/rendered-by": "scripts/gitops-render.mjs"
@@ -2939,7 +2943,11 @@ async function runtimeItems() {
}
function runtimeSourceCommit(item) {
return item.spec?.template?.metadata?.labels?.["hwlab.pikastech.local/source-commit"] ||
return item.spec?.template?.metadata?.labels?.["hwlab.pikastech.local/gitops-render-source-commit"] ||
item.spec?.template?.metadata?.annotations?.["hwlab.pikastech.local/gitops-render-source-commit"] ||
item.metadata?.labels?.["hwlab.pikastech.local/gitops-render-source-commit"] ||
item.metadata?.annotations?.["hwlab.pikastech.local/gitops-render-source-commit"] ||
item.spec?.template?.metadata?.labels?.["hwlab.pikastech.local/source-commit"] ||
item.spec?.template?.metadata?.annotations?.["hwlab.pikastech.local/source-commit"] ||
item.metadata?.labels?.["hwlab.pikastech.local/source-commit"] ||
item.metadata?.annotations?.["hwlab.pikastech.local/source-commit"] ||