diff --git a/scripts/gitops-render.mjs b/scripts/gitops-render.mjs index 8d36b6bc..ba640357 100644 --- a/scripts/gitops-render.mjs +++ b/scripts/gitops-render.mjs @@ -1572,12 +1572,22 @@ function prepareSourceScript() { "import fs from \"node:fs\";", "import { readStructuredFile } from \"./scripts/src/structured-config.mjs\";", "const [catalogPath, deployPath, selectedServices] = process.argv.slice(2);", - "const ids = (doc) => (doc.services || []).map((service) => service.serviceId);", - "const selected = (selectedServices || \"\").split(\",\").filter(Boolean);", + "const ids = (doc) => (doc.services || []).map((service) => service.serviceId).filter(Boolean);", + "const selected = (selectedServices || \"\").split(\",\").map((item) => item.trim()).filter(Boolean);", + "const uniqueSorted = (items) => [...new Set(items)].sort();", "const gitops = JSON.parse(fs.readFileSync(catalogPath, \"utf8\"));", "const deploy = await readStructuredFile(process.cwd(), deployPath);", "const expected = selected.length ? selected : ids(deploy);", - "if (JSON.stringify(ids(gitops)) !== JSON.stringify(expected)) process.exit(42);", + "const actual = ids(gitops);", + "const expectedSet = uniqueSorted(expected);", + "const actualSet = uniqueSorted(actual);", + "const sameServices = expectedSet.length === actualSet.length && expectedSet.every((item, index) => item === actualSet[index]);", + "if (!sameServices) {", + " const missing = expectedSet.filter((item) => !actualSet.includes(item));", + " const extra = actualSet.filter((item) => !expectedSet.includes(item));", + " console.error(JSON.stringify({ event: \"gitops-artifact-catalog\", phase: \"prepare-source\", status: \"ignored-stale\", reason: \"service-ids-mismatch\", expected, actual, missing, extra }));", + " process.exit(42);", + "}", "NODE", " then", " cp /tmp/hwlab-gitops-artifact-catalog.json \"$catalog_path\"", diff --git a/scripts/src/ci-plan-lib.mjs b/scripts/src/ci-plan-lib.mjs index 9f9abb6a..230554ec 100644 --- a/scripts/src/ci-plan-lib.mjs +++ b/scripts/src/ci-plan-lib.mjs @@ -666,10 +666,20 @@ export async function hashGitPaths(repoRoot, targetRef, paths, options = {}) { async function hashEnvReuseInputs(repoRoot, targetRef, paths, recipe, options = {}) { return stableHash({ gitPaths: await hashGitPaths(repoRoot, targetRef, paths, options), - envRecipe: recipe + envRecipe: envReuseIdentityRecipe(recipe) }); } +function envReuseIdentityRecipe(recipe) { + const identity = JSON.parse(JSON.stringify(recipe ?? {})); + if (identity.downloadStack && typeof identity.downloadStack === "object") { + delete identity.downloadStack.httpProxy; + delete identity.downloadStack.httpsProxy; + delete identity.downloadStack.noProxy; + } + return identity; +} + export async function lastCommitForPaths(repoRoot, targetRef, paths) { const normalizedPaths = uniqueSorted(paths.map(normalizeRepoPath).filter(Boolean)); if (normalizedPaths.length === 0) return null;