-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Scope config lookup to org #19217
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
Scope config lookup to org #19217
Conversation
/gh run recreate-vm=true |
This PR should also fix issue EXP-986 |
Original issue EXP-962 will not fix completely because there can be multiple configrations for the same repo in the same organization. But it can unblock lots of users (maybe almost all? Since actual multiple case should not that normal) with this problem 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Works as promised
@@ -120,7 +120,11 @@ export class ContextService { | |||
if (options?.projectId) { | |||
project = await this.projectsService.getProject(user.id, options.projectId); | |||
} else if (CommitContext.is(context)) { | |||
const projects = await this.projectsService.findProjectsByCloneUrl(user.id, context.repository.cloneUrl); | |||
const projects = await this.projectsService.findProjectsByCloneUrl( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if we added DB tests for various cases.
const repo = await this.getRepo(); | ||
const conditions: FindConditions<DBProject> = { cloneUrl, markedDeleted: false }; | ||
const conditions: FindConditions<DBProject> = { cloneUrl, markedDeleted: false, teamId: organizationId }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it work here? If teamId is present but undefined then it doest not count or it will check as null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeOrm don't know it's null unless we use something like Null
(not sure) or queryBuild with IS NULL
,
so condition would be { cloneUrl, markedDeleted: false }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to worry if organizationId
is default value => EmptyString in gPRC, then it will find with { teamId: "" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
When creating a workspace, we check if by any chance there aren't multiple configurations for this repository, because we cannot just guess it by the context URL you provided. This lookup was previously done on a global level, so if anyone in the world configured a repo which you also had configured, you would start getting a
Multiple projects found for clone URL.
error.This change tweaks the behavior so that even if you had a repo configured across two organizations, only the one for the currently active one will apply.
Important
This PR does not address the same error message caused by multiple configurations of the same repo within a single organization. This will come later most likely via a
--configuration
flag forgitpod workspace create
.Related Issue(s)
Fixes EXP-962
How to test
gitpod login --host https://ft-ws-crea72590a191a.preview.gitpod-dev.com/
gitpod ws create "https://github.com/gitpod-io/gitpod"
Preview status
Gitpod was successfully deployed to your preview environment.
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled.