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

batches: supportsCommitSigning field to BatchChangesCodeHosts#52473

Merged
st0nebreaker merged 4 commits into
batches/commit-signingfrom
becca/commitSigningEnabled
May 26, 2023
Merged

batches: supportsCommitSigning field to BatchChangesCodeHosts#52473
st0nebreaker merged 4 commits into
batches/commit-signingfrom
becca/commitSigningEnabled

Conversation

@st0nebreaker

@st0nebreaker st0nebreaker commented May 25, 2023

Copy link
Copy Markdown
Contributor

Closes #52465, setup for #52220

Adds new supportsCommitSigning field to the BatchChangesCodeHosts resolver. Only GitHub external services have commit signing for now. Later on we will support more code hosts. Even though different mechanisms will support the commit signing (ie SSH keys), that will be handled downstream.

Test plan

image

  • Nav to /site-admin/batch-changes
  • Ensure /graphql?GlobalBatchChangesCodeHosts returns the correct value for supportsCommitSigning

@cla-bot cla-bot Bot added the cla-signed label May 25, 2023
@st0nebreaker st0nebreaker changed the base branch from main to batches/commit-signing May 25, 2023 22:38
Comment thread enterprise/cmd/frontend/internal/batches/resolvers/code_host.go Outdated
@st0nebreaker st0nebreaker marked this pull request as ready for review May 25, 2023 22:42
@st0nebreaker st0nebreaker requested a review from a team May 25, 2023 22:42
@st0nebreaker st0nebreaker self-assigned this May 25, 2023
@sourcegraph-bot

sourcegraph-bot commented May 25, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff 98bc90f...8dc039f.

Notify File(s)
@courier-new cmd/frontend/graphqlbackend/batches.go
@eseliger cmd/frontend/graphqlbackend/batches.go
enterprise/internal/batches/types/code_host.go

@sourcegraph-buildkite

sourcegraph-buildkite commented May 25, 2023

Copy link
Copy Markdown
Collaborator

Bundle size report 📦

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

Look at the Statoscope report for a full comparison between the commits 8dc039f 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

@sourcegraph-bot

sourcegraph-bot commented May 25, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@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.

Code looks fine, but I have a bit of feedback regarding intentions for adding this field! I admit on first read, I thought hasCommitSigning had to do with whether or not a code host had a GH App already configured for it for commit signing, but it's clear to me now from your PR description and changes that it's actually referring to whether or not a code host type can support commit signing today. With that in mind, two questions:

  1. Could we name the field supportsCommitSigning instead, to clear up what it refers to?
  2. Do you mind just briefly walking me through how we intend to use this field on the frontend? I could make some guesses, and I may have some feedback based on those guesses, but I'd rather hear from you (or Bolaji) first. 🙂

Comment thread enterprise/cmd/frontend/internal/batches/resolvers/code_host.go Outdated
Comment thread enterprise/cmd/frontend/internal/batches/resolvers/code_host.go Outdated
@st0nebreaker

Copy link
Copy Markdown
Contributor Author

Yes I can definitely rename it. I was aiming to match the HasWebhooks language, but "supports" here is more clear - agreed.

  1. Do you mind just briefly walking me through how we intend to use this field on the frontend? I could make some guesses, and I may have some feedback based on those guesses, but I'd rather hear from you (or Bolaji) first. 🙂

Sure thing - The train of thought is because we will allow a GH App for each GH instance, we'll show each code host connection, this keeps the same format as our code host tokens too for uniformity. The frontend will read if supportsCommitSigning = true to give any GH App actions or show some disabled/not-supported badge state.

Later on, say if we support commit signing through SSH keys for GitLab/BitBucket, we can determine on the frontend node whether to show Create GH App or Add credentials button. Does that capture the thinking @BolajiOlajide ?

image

st0nebreaker and others added 2 commits May 25, 2023 17:15

@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.

Got it, thanks for that explanation. I was thinking about alternative ways to surface this information but ultimately I think I like the flexibility that this simple boolean property affords us for the future. To reiterate what I said in Slack in a more public forum, I like that this field is completely agnostic to the actual underlying method we use to sign commits. On top of that, I was thinking about how we'd practically pair this property on the frontend with some sort of joint query for the GH App, and I settled on this proposal for that, which I think pairs nicely with this property. 🙂 So 👍

externalServiceURL
requiresSSH
requiresUsername
supportsCommitSigning

@courier-new courier-new May 26, 2023

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.

Thank you for validating the property appears in the network request as part of your test plan! For now, it might make more sense to drop it and only push the backend changes in this PR. Otherwise, the TS compiler starts to expect this property to be required everywhere we're mocking a code host (e.g. in storybook stories) and grows quite angry when it's not there. 😬 I don't want you to have to bloat this PR with all those mock data changes!

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.

Oh good call. Yea I'll leave that bloat for the FE consumption of this PR 😁 Removed

@st0nebreaker st0nebreaker changed the title batches: hasCommitSigning field to BatchChangesCodeHosts batches: supportsCommitSigning field to BatchChangesCodeHosts May 26, 2023
@st0nebreaker st0nebreaker merged this pull request into batches/commit-signing May 26, 2023
@st0nebreaker st0nebreaker deleted the becca/commitSigningEnabled branch May 26, 2023 15:47
BolajiOlajide pushed a commit that referenced this pull request May 26, 2023
…52473)

Closes
#[52465](https://github.com/sourcegraph/sourcegraph/issues/52465), setup
for #[52220](https://github.com/sourcegraph/sourcegraph/issues/52220)

Adds new `supportsCommitSigning ` field to the `BatchChangesCodeHosts`
resolver. Only GitHub external services have commit signing for now.
Later on we will support more code hosts. Even though different
mechanisms will support the commit signing (ie SSH keys), that will be
handled downstream.

## Test plan

![image](https://github.com/sourcegraph/sourcegraph/assets/59381432/dd77362f-769e-4f5d-a8aa-ae755344e9fc)
- Nav to `/site-admin/batch-changes`
- Ensure `/graphql?GlobalBatchChangesCodeHosts` returns the correct
value for `supportsCommitSigning `

---------

Co-authored-by: Kelli Rockwell <kelli@sourcegraph.com>
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.

4 participants