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

Add Bitbucket Cloud permissions syncing#46312

Merged
pjlast merged 13 commits into
pjlast/19782-bitbucket-cloud-auth-providerfrom
pjlast/19782-bitbucket-cloud-permissions-syncing
Jan 16, 2023
Merged

Add Bitbucket Cloud permissions syncing#46312
pjlast merged 13 commits into
pjlast/19782-bitbucket-cloud-auth-providerfrom
pjlast/19782-bitbucket-cloud-permissions-syncing

Conversation

@pjlast

@pjlast pjlast commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Adds permissions syncing for Bitbucket Cloud code host connections.

Loom: https://www.loom.com/share/1378727858244c8394d0ce705e4a85ae

Test plan

Unit tests added. I also did manual verifications and confirmed things like token refreshing.

@sg-e2e-regression-test-bob

sg-e2e-regression-test-bob commented Jan 11, 2023

Copy link
Copy Markdown

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.02% (+3.43 kb) 0.03% (+3.43 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 7d33526 and 573a8bb 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

@pjlast pjlast marked this pull request as ready for review January 11, 2023 11:03
@pjlast pjlast requested a review from a team January 11, 2023 11:04
@sourcegraph-bot

sourcegraph-bot commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff e512427...7d33526.

Notify File(s)
@LawnGnome internal/extsvc/bitbucketcloud/client.go
internal/extsvc/bitbucketcloud/common.go
internal/extsvc/bitbucketcloud/repositories.go
internal/extsvc/bitbucketcloud/repositories_test.go
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-Fork-recreated
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-Fork-valid-omitted-destination-branch
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-SameOrigin-recreated
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-SameOrigin-valid-destination-branch
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-DeclinePullRequest-found
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-ForkRepository-success
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-GetPullRequest-found
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-MergePullRequest-found
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-Repo-valid-repo
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-UpdatePullRequest-found
internal/extsvc/bitbucketcloud/types.go
@eseliger enterprise/internal/batches/sources/mocks_test.go
internal/extsvc/bitbucketcloud/client.go
internal/extsvc/bitbucketcloud/common.go
internal/extsvc/bitbucketcloud/repositories.go
internal/extsvc/bitbucketcloud/repositories_test.go
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-Fork-recreated
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-Fork-valid-omitted-destination-branch
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-SameOrigin-recreated
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-CreatePullRequest-SameOrigin-valid-destination-branch
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-DeclinePullRequest-found
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-ForkRepository-success
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-GetPullRequest-found
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-MergePullRequest-found
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-Repo-valid-repo
internal/extsvc/bitbucketcloud/testdata/golden/TestClient-UpdatePullRequest-found
internal/extsvc/bitbucketcloud/types.go
@indradhanush internal/repos/bitbucketcloud.go
@ryanslade internal/repos/bitbucketcloud.go
@sashaostrikov internal/repos/bitbucketcloud.go
@sourcegraph/delivery doc/admin/auth/index.md
doc/admin/external_service/bitbucket_cloud.md
@unknwon enterprise/cmd/frontend/internal/auth/bitbucketcloudoauth/config_test.go
enterprise/cmd/frontend/internal/auth/bitbucketcloudoauth/middleware_test.go
enterprise/cmd/frontend/internal/auth/bitbucketcloudoauth/provider.go
enterprise/cmd/frontend/internal/auth/bitbucketcloudoauth/provider_test.go
enterprise/internal/authz/authz.go
enterprise/internal/authz/authz_test.go
enterprise/internal/authz/bitbucketcloud/authz.go
enterprise/internal/authz/bitbucketcloud/authz_test.go
enterprise/internal/authz/bitbucketcloud/provider.go
enterprise/internal/authz/bitbucketcloud/provider_test.go

Comment thread enterprise/internal/authz/bitbucketcloud/provider.go Outdated
Comment thread enterprise/internal/authz/bitbucketcloud/provider.go Outdated
Comment thread enterprise/internal/authz/bitbucketcloud/provider.go Outdated
Comment thread enterprise/internal/authz/bitbucketcloud/provider.go Outdated
Comment on lines +34 to +35
AuthURL: bbURL + "/site/oauth2/authorize",
TokenURL: bbURL + "/site/oauth2/access_token",

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.

Could we use JoinPath instead of naively merging strings for URL paths?

reposURL = "/2.0/repositories"
} else {
next, err = c.page(ctx, fmt.Sprintf("/2.0/repositories/%s", accountName), nil, pageToken, &repos)
reposURL = fmt.Sprintf("/2.0/repositories/%s", accountName)

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.

For adding path params we should probably use PathEscape instead.

Comment thread internal/extsvc/bitbucketcloud/repositories.go Outdated

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

😅 Made it through

Comment thread doc/admin/auth/index.md Outdated
Comment on lines +182 to +186
bbcloudProviders, bbcloudProblems, bbcloudWarnings, bbcloudInvalidConnections := bitbucketcloud.NewAuthzProviders(db, bitbucketCloudConns, cfg.SiteConfig().AuthProviders)
providers = append(providers, bbcloudProviders...)
seriousProblems = append(seriousProblems, bbcloudProblems...)
warnings = append(warnings, bbcloudWarnings...)
invalidConnections = append(invalidConnections, bbcloudInvalidConnections...)

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.

wow (comment unrelated to this PR)

Comment thread enterprise/internal/authz/bitbucketcloud/provider.go Outdated
Comment thread internal/extsvc/bitbucketcloud/client.go Outdated
@pjlast pjlast merged this pull request into pjlast/19782-bitbucket-cloud-auth-provider Jan 16, 2023
@pjlast pjlast deleted the pjlast/19782-bitbucket-cloud-permissions-syncing branch January 16, 2023 08:09
pjlast added a commit that referenced this pull request Jan 16, 2023
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