Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

batches: filter github apps for domain#52330

Merged
BolajiOlajide merged 0 commit into
batches/commit-signingfrom
bb/filter-out-non-repos-gh-apps
May 26, 2023
Merged

batches: filter github apps for domain#52330
BolajiOlajide merged 0 commit into
batches/commit-signingfrom
bb/filter-out-non-repos-gh-apps

Conversation

@BolajiOlajide

Copy link
Copy Markdown
Contributor

Closes #52324

Now that we have different GitHub apps for different domains, this PR adds a filtering mechanism so we don't get a conflict.

CleanShot 2023-05-23 at 19 49 59@2x

The initial UI work filters non-repos GitHub apps from the GitHub apps section in Site Admin settings

Test plan

We don't yet have a mechanism for creating non-repos GitHub apps for now, so for now, the steps to follow are as follows:

  • Create a GitHub app via the normal flow.
  • Update the domain field to something other than repos

CleanShot 2023-05-23 at 19 55 02@2x

@sourcegraph-buildkite

sourcegraph-buildkite commented May 23, 2023

Copy link
Copy Markdown
Collaborator

Bundle size report 📦

Initial size Total size Async size Modules
0.01% (+0.22 kb) 0.00% (+0.65 kb) 0.00% (+0.43 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits b801193 and 60d130d or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@st0nebreaker st0nebreaker marked this pull request as ready for review May 23, 2023 20:23
@sourcegraph-bot

sourcegraph-bot commented May 23, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 54fb51bffdd0c2776f85033db08ad28b3a8a31f0...b8011939a6c3f5e36ae5591e90e78237c480a224.

Notify File(s)
@unknwon enterprise/cmd/frontend/internal/auth/githubappauth/middleware.go
enterprise/cmd/frontend/internal/auth/githubappauth/resolver.go
enterprise/cmd/frontend/internal/auth/githubappauth/resolver_test.go

@sourcegraph-bot

sourcegraph-bot commented May 23, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@BolajiOlajide BolajiOlajide force-pushed the bb/filter-out-non-repos-gh-apps branch from ed5ba97 to f1ac900 Compare May 24, 2023 03:29
@BolajiOlajide BolajiOlajide requested a review from a team May 24, 2023 04:03

@courier-new courier-new left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, just had a couple minor suggestions. 🙂

Comment on lines +9 to +10
query GitHubApps($domain: String) {
gitHubApps(domain: $domain) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No strong feelings about this, but we could also hardcode in the repos domain for this query string to be clearer about its purpose, since presumably we'll define a separate query with separate fields for the Batch Changes page.

Comment thread cmd/frontend/graphqlbackend/githubapps.go Outdated
Comment thread enterprise/internal/github_apps/store/store.go Outdated
Comment thread cmd/frontend/graphqlbackend/githubapps.graphql Outdated
@st0nebreaker st0nebreaker force-pushed the bb/filter-out-non-repos-gh-apps branch from 102e7cd to 882f2bd Compare May 24, 2023 19:11
Comment thread cmd/frontend/graphqlbackend/githubapps.graphql Outdated
Comment thread cmd/frontend/graphqlbackend/githubapps.graphql Outdated
Comment thread cmd/frontend/graphqlbackend/githubapps.graphql Outdated
Comment thread enterprise/cmd/frontend/internal/auth/githubappauth/resolver_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
@st0nebreaker st0nebreaker force-pushed the bb/filter-out-non-repos-gh-apps branch 2 times, most recently from c741a7a to 6b201c9 Compare May 25, 2023 05:24
@st0nebreaker st0nebreaker requested a review from courier-new May 25, 2023 06:00

@courier-new courier-new left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Amazingggg 👏 Just had some minor nits, all of which I tried to provide with suggestions so hopefully you can just commit them and be on your way. 🎉

Comment thread enterprise/cmd/frontend/internal/auth/githubappauth/resolver_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
Comment thread enterprise/internal/github_apps/store/store_test.go Outdated
Comment thread enterprise/cmd/frontend/internal/auth/githubappauth/resolver_test.go Outdated
Comment thread internal/types/types.go Outdated
@BolajiOlajide BolajiOlajide force-pushed the bb/filter-out-non-repos-gh-apps branch from 58b5be5 to b801193 Compare May 26, 2023 15:48
webhookUUID, err := uuid.Parse(stateDeets.WebhookUUID)
if err != nil {
http.Error(w, fmt.Sprintf("Bad request, could not parse webhook UUID: %s", err.Error()), http.StatusBadRequest)
http.Error(w, fmt.Sprintf("Bad request, could not parse webhook UUID: %v", err), http.StatusBadRequest)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed this so we don't have a lot of err.Error() everywhere, it's basically the same as what we had before.

The %v formatting directive will print the error message.

I added a sample here for you to check @st0nebraker .

return nil, nil
}
switch *s {
switch strings.ToUpper(*s) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated this to convert the domain to a UPPER case string because this method is being used in the route handler for /redirect and in that handler, the domain is lowercased.

@BolajiOlajide BolajiOlajide merged this pull request into batches/commit-signing May 26, 2023
@BolajiOlajide BolajiOlajide deleted the bb/filter-out-non-repos-gh-apps branch May 26, 2023 18:01
BolajiOlajide added a commit that referenced this pull request May 26, 2023
Co-authored-by: Becca Steinbrecher <beccasteinbrecher@gmail.com>
Co-authored-by: Kelli Rockwell <kelli@sourcegraph.com>
Co-authored-by: Becca Steinbrecher <becca.steinbrecher@sourcegraph.com>
Closes [#52324](https://github.com/sourcegraph/sourcegraph/issues/52324)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants