Merge pull request #1836 from pikasTech/fix/1832-runtime-catalog-normalize-20260621
fix: 补齐 runtime lane catalog 服务
This commit is contained in:
@@ -738,12 +738,19 @@ function bootShForService(deployManifest, serviceId, lane) {
|
||||
return text;
|
||||
}
|
||||
|
||||
function normalizeCatalogForLane(catalog, lane, deployManifest) {
|
||||
function normalizeCatalogForLane(catalog, args, deployManifest, commitId) {
|
||||
const lane = args?.lane;
|
||||
if (!catalog || !isRuntimeArtifactLane(lane)) return catalog;
|
||||
const allowed = new Set(runtimeLaneServiceIdsFromDeploy(deployManifest, lane));
|
||||
const serviceIds = runtimeLaneServiceIdsFromDeploy(deployManifest, lane);
|
||||
const allowed = new Set(serviceIds);
|
||||
const existingById = new Map((catalog.services ?? [])
|
||||
.filter((service) => allowed.has(service.serviceId))
|
||||
.map((service) => [service.serviceId, service]));
|
||||
const tag = imageTagForCommit(args, commitId);
|
||||
return {
|
||||
...catalog,
|
||||
services: (catalog.services ?? []).filter((service) => allowed.has(service.serviceId))
|
||||
services: serviceIds.map((serviceId) => existingById.get(serviceId)
|
||||
?? artifactCatalogSkeletonService({ args, deployManifest, serviceId, tag, commitId }))
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2297,7 +2304,7 @@ async function main() {
|
||||
let catalog = await readConfigIfPresent(args.catalogPath, null);
|
||||
const catalogWasMissing = !catalog;
|
||||
if (!catalog && isRuntimeArtifactLane(args.lane)) catalog = artifactCatalogSkeleton({ args, deployManifest, commitId });
|
||||
catalog = normalizeCatalogForLane(catalog, args.lane, deployManifest);
|
||||
catalog = normalizeCatalogForLane(catalog, args, deployManifest, commitId);
|
||||
assert.ok(catalog, `${args.catalogPath} is required for ${args.lane} artifact publish`);
|
||||
const shortCommit = imageTagForCommit(args, commitId);
|
||||
let effectiveCatalogPath = args.catalogPath;
|
||||
|
||||
Reference in New Issue
Block a user