Skip to content

[server] createProject should not query all repositories – EXP-459 #18532

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 4 commits into from
Aug 17, 2023

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Aug 16, 2023

This is to fix issues when listing all repositories is super expensive and might even burn all the rate limit at the Git provider.

Description

Summary generated by Copilot

🤖 Generated by Copilot at 8c04321

This pull request adds a new method to check the user's ability to create a Gitpod project from a GitHub repository using the GitHub App integration. It also refactors the createProject API method to use the new check.

Related Issue(s)

Fixes EXP-459

How to test

See that you can create projects as it's used to be.

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@roboquat roboquat added size/L and removed size/M labels Aug 17, 2023
@AlexTugarev AlexTugarev force-pushed the at/createProject-fix branch from ed2075f to c3e4f87 Compare August 17, 2023 12:30
@AlexTugarev AlexTugarev force-pushed the at/createProject-fix branch from c3e4f87 to a15a073 Compare August 17, 2023 12:51
@AlexTugarev
Copy link
Member Author

Screenshot 2023-08-17 at 15 06 03 Screenshot 2023-08-17 at 15 06 21

Quickly re-tested that projects can created an webhooks are installed like before.

type === "GitLab" ||
type === "Bitbucket" ||
type === "BitbucketServer" ||
(type === "GitHub" && (authProvider?.host !== "github.com" || !this.config.githubApp?.enabled))
Copy link
Member

Choose a reason for hiding this comment

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

Feels like we are checking for all types we support explicitly. I wonder for which cases this code is not applicable...? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

@geropl
Copy link
Member

geropl commented Aug 17, 2023

(reviewing now 👀 )

Copy link
Member

@filiptronicek filiptronicek left a comment

Choose a reason for hiding this comment

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

Repo listing and project creation works like it's supposed to

} else {
return await this.scmService.canInstallWebhook(currentUser, cloneURL);

// note: the GitHub App based check is not included in the ProjectService due
Copy link
Member

@geropl geropl Aug 17, 2023

Choose a reason for hiding this comment

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

To me this is kind of a red flag to not but both things togehter in a SCMService, honestly. Also, most of that functionality seems util functions around HostContext and the likes, maybe we can place them in such a place (without injection) which resolves/avoids the cycle.

I would be ok to merge this today in favor of turnarounds, if we resolve it tomorrow maybe? 🙃

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's resolve this in a different context 🙏🏻

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested and works ✔️

the nit here can be adressed async

@AlexTugarev
Copy link
Member Author

/unhold

@roboquat roboquat merged commit 95d14d3 into main Aug 17, 2023
@roboquat roboquat deleted the at/createProject-fix branch August 17, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants