Skip to content

[server] fix prebuild organizationId #17289

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

Merged
merged 1 commit into from
Apr 19, 2023
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
11 changes: 2 additions & 9 deletions components/server/ee/src/prebuilds/prebuild-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class PrebuildManager {
}
}
}
if (project && context.ref && !project.settings?.keepOutdatedPrebuildsRunning) {
if (context.ref && !project.settings?.keepOutdatedPrebuildsRunning) {
try {
await this.abortPrebuildsForBranch({ span }, project, user, context.ref);
} catch (e) {
Expand Down Expand Up @@ -222,17 +222,10 @@ export class PrebuildManager {
}
}

let organizationId = (await this.teamDB.findTeamById(project.id))?.id;
if (!user.additionalData?.isMigratedToTeamOnlyAttribution) {
// If the user is not migrated to team-only attribution, we retrieve the organization from the attribution logic.
const attributionId = await this.userService.getWorkspaceUsageAttributionId(user, project.id);
organizationId = attributionId.kind === "team" ? attributionId.teamId : undefined;
}

const workspace = await this.workspaceFactory.createForContext(
{ span },
user,
organizationId,
project.teamId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The organizationId associated with the prebuild must be the same as the project's orgId.

project,
prebuildContext,
context.normalizedContextURL!,
Expand Down