From 7b32389442ed94d3113b5a12e2bfb04992f9af53 Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Mon, 6 Sep 2021 13:06:23 +0000 Subject: [PATCH] [projects] fix projectId for incremental prebuilds --- .../ee/src/workspace/workspace-factory.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/components/server/ee/src/workspace/workspace-factory.ts b/components/server/ee/src/workspace/workspace-factory.ts index fe878fca7d08d9..b4dbbaacabb8d4 100644 --- a/components/server/ee/src/workspace/workspace-factory.ts +++ b/components/server/ee/src/workspace/workspace-factory.ts @@ -117,6 +117,7 @@ export class WorkspaceFactoryEE extends WorkspaceFactory { ws = await this.createForCommit({span}, user, commitContext, normalizedContextURL); } ws.type = "prebuild"; + ws.projectId = project?.id; ws = await this.db.trace({span}).store(ws); const pws = await this.db.trace({span}).storePrebuiltWorkspace({ @@ -126,21 +127,18 @@ export class WorkspaceFactoryEE extends WorkspaceFactory { commit: commitContext.revision, state: "queued", creationTime: new Date().toISOString(), - projectId: project?.id, + projectId: ws.projectId, branch }); - { // TODO(at) store prebuild info - if (project) { - // do not await - this.storePrebuildInfo(ctx, project, pws, ws, user).catch(err => { - log.error(`failed to store prebuild info`, err); - TraceContext.logError({span}, err); - }); - } + if (project) { + // do not await + this.storePrebuildInfo(ctx, project, pws, ws, user).catch(err => { + log.error(`failed to store prebuild info`, err); + TraceContext.logError({span}, err); + }); } - log.debug({ userId: user.id, workspaceId: ws.id }, `Registered workspace prebuild: ${pws.id} for ${commitContext.repository.cloneUrl}:${commitContext.revision}`); return ws;