diff --git a/deploy/deploy.yaml b/deploy/deploy.yaml index 559d0610..7c9ba49a 100644 --- a/deploy/deploy.yaml +++ b/deploy/deploy.yaml @@ -1223,9 +1223,8 @@ lanes: HWPOD_TEMPORAL_ADDRESS: temporal-frontend.temporal.svc.cluster.local:7233 HWPOD_TEMPORAL_NAMESPACE: unidesk HWPOD_TEMPORAL_TASK_QUEUE: hwlab-v03-hwpod - HWPOD_RUNTIME_API_URL: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667 - HWPOD_RUNTIME_API_AUTHORIZATION: secretRef:hwlab-v03-master-server-admin-api-key/api-key - HWPOD_RUNTIME_API_AUTHORIZATION_PREFIX: Bearer + HWPOD_NODE_OPS_API_URL: http://hwlab-hwpod-api.hwlab-v03.svc.cluster.local:6681 + HWPOD_NODE_WS_TOKEN: secretRef:hwlab-v03-hwpod-node-auth/token HWPOD_SPEC_DATABASE_URL: secretRef:hwlab-cloud-api-v03-db/database-url HWPOD_SPEC_DATABASE_SCHEMA: hwpod HWPOD_SPEC_DATABASE_TABLE: runtime_specs @@ -1245,9 +1244,7 @@ lanes: HWPOD_TEMPORAL_ADDRESS: temporal-frontend.temporal.svc.cluster.local:7233 HWPOD_TEMPORAL_NAMESPACE: unidesk HWPOD_TEMPORAL_TASK_QUEUE: hwlab-v03-hwpod - HWPOD_RUNTIME_API_URL: http://hwlab-cloud-api.hwlab-v03.svc.cluster.local:6667 - HWPOD_RUNTIME_API_AUTHORIZATION: secretRef:hwlab-v03-master-server-admin-api-key/api-key - HWPOD_RUNTIME_API_AUTHORIZATION_PREFIX: Bearer + HWPOD_NODE_OPS_API_URL: http://hwlab-hwpod-api.hwlab-v03.svc.cluster.local:6681 HWPOD_SPEC_DATABASE_URL: secretRef:hwlab-cloud-api-v03-db/database-url HWPOD_SPEC_DATABASE_SCHEMA: hwpod HWPOD_SPEC_DATABASE_TABLE: runtime_specs diff --git a/scripts/ci-plan.test.mjs b/scripts/ci-plan.test.mjs index dc5ae56c..f78e572e 100644 --- a/scripts/ci-plan.test.mjs +++ b/scripts/ci-plan.test.mjs @@ -446,6 +446,42 @@ test("node CI planner scopes runtime config rendering to the changed service wit assert.equal(plan.ciCdPlan.noImageBuildReason, "runtime-config-only-change"); }); +test("v03 planner scopes lane service runtime overrides without image builds", async () => { + const selectedServices = ["hwlab-cloud-api", "hwlab-cloud-web", "hwlab-gateway"]; + const repo = await createFixtureRepo({ serviceIds: selectedServices }); + const deployPath = path.join(repo, "deploy/deploy.yaml"); + const deploy = await readStructuredFile(repo, deployPath); + deploy.lanes.v03.services = selectedServices.map((serviceId) => ({ serviceId, env: { RUNTIME_REVISION: "v1" } })); + await writeStructuredFile(repo, deployPath, deploy); + await git(repo, ["add", "deploy/deploy.yaml"]); + await git(repo, ["commit", "-m", "seed v03 runtime overrides"]); + + deploy.lanes.v03.services.find((service) => service.serviceId === "hwlab-cloud-api").env.RUNTIME_REVISION = "v2"; + deploy.lanes.v03.services.find((service) => service.serviceId === "hwlab-cloud-web").env.RUNTIME_REVISION = "v2"; + await writeStructuredFile(repo, deployPath, deploy); + await git(repo, ["add", "deploy/deploy.yaml"]); + await git(repo, ["commit", "-m", "change two v03 runtime overrides"]); + + const plan = await createCiPlan({ + repoRoot: repo, + lane: "v03", + baseRef: "HEAD~1", + targetRef: "HEAD", + artifactCatalogPath: "deploy/artifact-catalog.v03.json", + services: selectedServices + }); + + assert.deepEqual(plan.affectedServices, ["hwlab-cloud-api", "hwlab-cloud-web"]); + assert.deepEqual(plan.rolloutServices, ["hwlab-cloud-api", "hwlab-cloud-web"]); + assert.deepEqual(plan.buildServices, []); + assert.deepEqual(plan.rolloutWithoutImageBuildServices, ["hwlab-cloud-api", "hwlab-cloud-web"]); + assert.deepEqual(plan.reusedServices, ["hwlab-gateway"]); + assert.equal(plan.services.find((service) => service.serviceId === "hwlab-cloud-api").runtimeConfigChanged, true); + assert.equal(plan.services.find((service) => service.serviceId === "hwlab-cloud-web").runtimeConfigChanged, true); + assert.equal(plan.services.find((service) => service.serviceId === "hwlab-gateway").runtimeConfigChanged, false); + assert.equal(plan.ciCdPlan.noImageBuildReason, "runtime-config-only-change"); +}); + test("node CI planner keeps Tekton renderer changes out of runtime rollout scope", async () => { const repo = await createFixtureRepo(); await mkdir(path.join(repo, "scripts/src/gitops-render"), { recursive: true }); diff --git a/scripts/src/ci-plan-lib.mjs b/scripts/src/ci-plan-lib.mjs index 62e3e0f0..5615bd58 100644 --- a/scripts/src/ci-plan-lib.mjs +++ b/scripts/src/ci-plan-lib.mjs @@ -748,10 +748,21 @@ function serviceRuntimeConfigIdentity(deployJson, lane, serviceId) { healthPort: Number.isInteger(declaration.healthPort) ? declaration.healthPort : null, healthProbe: normalizeServiceHealthProbe(declaration.healthProbe), env: normalizeServiceEnv(declaration.env), - observable: declaration.observable === true + observable: declaration.observable === true, + baseRuntimeService: runtimeServiceConfigById(deployJson?.services, serviceId), + laneRuntimeService: runtimeServiceConfigById(laneConfig?.services, serviceId) }; } +function runtimeServiceConfigById(services, serviceId) { + if (!Array.isArray(services)) return null; + let match = null; + for (const service of services) { + if (service?.serviceId === serviceId) match = service; + } + return match; +} + export async function packageRuntimeFieldsChanged(repoRoot, baseRef, targetRef, filePath = "package.json") { const [before, after] = await Promise.all([ readJsonFromGit(repoRoot, baseRef, filePath, null),