Skip to content

Adding searchRepositories jsonrpc method #18827

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 11 commits into from
Sep 29, 2023
Merged

Conversation

selfcontained
Copy link
Contributor

@selfcontained selfcontained commented Sep 27, 2023

Description

Adds a new searchRepositories() method to server to assist in enhancing the repo selector for creating new workspaces/projects that searches across scm providers. It then integrates that call into the <RepositoryFinder/> component used on the create workspace page.

The feature is behind a new flag, repositoryFinderSearch, which is only on in non-prod.

image
  • GitHub implemented in this PR
  • BBS, Bitbucket & Gitlab will be implemented in followup PRs to keep this scope from growing too large and make testing incrementally easier.
Summary generated by Copilot

🤖 Generated by Copilot at 558dbf7

Added a new API method searchRepositories to the GitpodServer interface and implemented it for the GitpodServerImpl class. Added stub or working implementations of the searchRepos method to the various RepositoryProvider classes for different repohosts. The purpose of these changes is to enable a repository search feature for workspace creation.

Related Issue(s)

Fixes EXP-729

How to test

  • Try out the preview environment, and you should have repo searching enabled by default. Try searching for public and private repos both personal and in orgs you belong to in GitHub.
  • Join this org (which has the feature flag disabled) and you shouldn't see any repo searching behavior.

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

@selfcontained selfcontained force-pushed the brad/searchRepositories-method branch from 216dc01 to b5e789f Compare September 28, 2023 15:54
@roboquat roboquat added size/XL and removed size/L labels Sep 28, 2023
@selfcontained selfcontained marked this pull request as ready for review September 28, 2023 23:15
@selfcontained selfcontained requested a review from a team as a code owner September 28, 2023 23:15
log.warn(logCtx, "Error searching user repos", err);
});

// TODO: Look at using graphql query to grab all orgs w/ some kind of latest activity date
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan on doing this before we'd enable the flag, but wanted to start getting feedback sooner. This may be grabbing orgs that aren't necessarily relevant w/ recent activity. I anticipate we'll have similar challenges w/ other scm providers, so can look at it at the same time.

.run(user, async (api) => {
return api.orgs.listMembershipsForAuthenticatedUser({
state: "active",
per_page: 5,
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to find a repo that I have access to but couldn't find it. Probably because it is not among those 5 orgs. Would it be to slow to search all orgs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we aim to already provide the "active" repositories with the other query that doesn't pass in a search, I believe this one should rather be complete in what I can find and could compromise a bit (if not too much) on performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yah I agree. I'll play around with it a bit more.

@selfcontained
Copy link
Contributor Author

/unhold

@roboquat roboquat merged commit 89af3c0 into main Sep 29, 2023
@roboquat roboquat deleted the brad/searchRepositories-method branch September 29, 2023 19:28
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.

3 participants