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

webhooks: Add support for secrets for Bitbucket Cloud#63198

Merged
eseliger merged 1 commit into
mainfrom
es/06-11-webhooksaddsupportforsecretsforbitbucketcloud
Jun 18, 2024
Merged

webhooks: Add support for secrets for Bitbucket Cloud#63198
eseliger merged 1 commit into
mainfrom
es/06-11-webhooksaddsupportforsecretsforbitbucketcloud

Conversation

@eseliger

@eseliger eseliger commented Jun 11, 2024

Copy link
Copy Markdown
Member

We didn't support secrets for bitbucket cloud so far, but the code host does support them. They use the same mechanism as Bitbucket and GitHub so that was easy to add.

Closes SRC-393

Test plan:

Set up a webhook locally and tested that with a wrong secret it fails, and with the correct secret it passes. Also wrote a test.

@cla-bot cla-bot Bot added the cla-signed label Jun 11, 2024
@github-actions github-actions Bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels Jun 11, 2024

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @eseliger and the rest of your teammates on Graphite Graphite

@eseliger eseliger force-pushed the es/06-11-webhooksaddsupportforsecretsforbitbucketcloud branch from d4321b2 to 0d74a8d Compare June 11, 2024 11:05
We didn't support secrets for bitbucket cloud so far, but the code host does support them. They use the same mechanism as Bitbucket and GitHub so that was easy to add.

Test plan:

Set up a webhook locally and tested that with a wrong secret it fails, and with the correct secret it passes. Also wrote a test.
@eseliger eseliger force-pushed the es/06-11-webhooksaddsupportforsecretsforbitbucketcloud branch from 0d74a8d to 658b458 Compare June 11, 2024 11:41
@eseliger eseliger marked this pull request as ready for review June 11, 2024 11:41
@eseliger eseliger requested a review from a team June 11, 2024 11:41
function codeHostSupportsSecretes(codeHostKind: ExternalServiceKind): boolean {
if (codeHostKind === ExternalServiceKind.BITBUCKETCLOUD || codeHostKind === ExternalServiceKind.AZUREDEVOPS) {
function codeHostSupportsSecrets(codeHostKind: ExternalServiceKind): boolean {
if (codeHostKind === ExternalServiceKind.AZUREDEVOPS) {

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.

I wonder if would be better to use an exhaustive switch statement here (with no default)? This way the typescript compiler can help us in the future if we had a new code host kind by telling us when we haven't handled a case.

Ex

Suggested change
if (codeHostKind === ExternalServiceKind.AZUREDEVOPS) {
switch (codeHostKind) {
case ExternalServiceKind.AZUREDEVOPS:
return false
case ExternalServiceKind.BITBUCKETCLOUD:
return true
// ...
}

"io"
"net/http"

gh "github.com/google/go-github/v55/github"

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.

This is a bit of an odd import here...

@eseliger eseliger merged commit 3e3ef6e into main Jun 18, 2024
@eseliger eseliger deleted the es/06-11-webhooksaddsupportforsecretsforbitbucketcloud branch June 18, 2024 09:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants