Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[projects] fix projectId for incremental prebuilds #5540

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions components/server/ee/src/workspace/workspace-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export class WorkspaceFactoryEE extends WorkspaceFactory {
ws = await this.createForCommit({span}, user, commitContext, normalizedContextURL);
}
ws.type = "prebuild";
ws.projectId = project?.id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still argue that this belongs into createForPrebuiltWorkspace (as optional parameter) but that's not too important here, and this fixes it as well.

ws = await this.db.trace({span}).store(ws);

const pws = await this.db.trace({span}).storePrebuiltWorkspace({
Expand All @@ -126,21 +127,18 @@ export class WorkspaceFactoryEE extends WorkspaceFactory {
commit: commitContext.revision,
state: "queued",
creationTime: new Date().toISOString(),
projectId: project?.id,
projectId: ws.projectId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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;
Expand Down