Skip to content
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

feat: adding support for bitbucket cloud webhook secrets #4275

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

almightyfoon
Copy link

what

Added support for Bitbucket Cloud Webhook secrets. Bitbucket added support in the cloud offering in October of 2023 Announcement

  • Ported the request validation libraries from bitbucket server to bitbucket cloud client.
  • Removed error check and associated test to ensure they aren't being used because they weren't supported

why

There is an open request for this #3909 and I'm also in need of this feature.

tests

I ran make test, the logic is the same as bitbucketserver.

Test results:
? github.com/runatlantis/atlantis [no test files]
ok github.com/runatlantis/atlantis/cmd 0.113s
ok github.com/runatlantis/atlantis/server (cached)
ok github.com/runatlantis/atlantis/server/controllers (cached)
ok github.com/runatlantis/atlantis/server/controllers/events (cached)
ok github.com/runatlantis/atlantis/server/controllers/templates (cached)
ok github.com/runatlantis/atlantis/server/controllers/websocket (cached)
ok github.com/runatlantis/atlantis/server/core/config (cached)
ok github.com/runatlantis/atlantis/server/core/config/raw (cached)
ok github.com/runatlantis/atlantis/server/core/config/valid (cached)
ok github.com/runatlantis/atlantis/server/core/db (cached)
ok github.com/runatlantis/atlantis/server/core/locking (cached)
ok github.com/runatlantis/atlantis/server/core/redis (cached)
ok github.com/runatlantis/atlantis/server/core/runtime (cached)
ok github.com/runatlantis/atlantis/server/core/runtime/cache (cached)
ok github.com/runatlantis/atlantis/server/core/runtime/common (cached)
ok github.com/runatlantis/atlantis/server/core/runtime/models (cached)
ok github.com/runatlantis/atlantis/server/core/runtime/policy (cached)
ok github.com/runatlantis/atlantis/server/core/terraform (cached)
ok github.com/runatlantis/atlantis/server/events (cached)
ok github.com/runatlantis/atlantis/server/events/command (cached)
ok github.com/runatlantis/atlantis/server/events/models (cached)
ok github.com/runatlantis/atlantis/server/events/terraform/ansi (cached)
ok github.com/runatlantis/atlantis/server/events/vcs (cached)
ok github.com/runatlantis/atlantis/server/events/vcs/bitbucketcloud (cached)
ok github.com/runatlantis/atlantis/server/events/vcs/bitbucketserver (cached)
ok github.com/runatlantis/atlantis/server/events/vcs/common (cached)
ok github.com/runatlantis/atlantis/server/events/webhooks (cached)
ok github.com/runatlantis/atlantis/server/jobs (cached)
ok github.com/runatlantis/atlantis/server/logging (cached)
ok github.com/runatlantis/atlantis/server/metrics (cached)
ok github.com/runatlantis/atlantis/server/recovery (cached)
? github.com/runatlantis/atlantis/testdrive [no test files]
ok github.com/runatlantis/atlantis/server/scheduled (cached)
ok github.com/runatlantis/atlantis/server/utils (cached)

references

Closes #3909

@almightyfoon almightyfoon requested review from a team as code owners February 22, 2024 05:27
@almightyfoon almightyfoon requested review from jamengual, lukemassa and nitrocode and removed request for a team February 22, 2024 05:27
@github-actions github-actions bot added go Pull requests that update Go code provider/bitbucket labels Feb 22, 2024
@almightyfoon almightyfoon changed the title adding support for bitbucket cloud webhook secrets feat: adding support for bitbucket cloud webhook secrets Feb 22, 2024
@github-actions github-actions bot added the docs Documentation label Feb 22, 2024
@jamengual jamengual added waiting-on-review Waiting for a review from a maintainer and removed docs Documentation labels Feb 26, 2024
@pavankumar-go
Copy link

kindly get this change merged. we are in very much need for this feature.

@jamengual jamengual added this to the v0.28.0 milestone Mar 26, 2024
@chenrui333 chenrui333 modified the milestones: v0.28.0, v0.29.0 May 22, 2024
@X-Guardian
Copy link
Contributor

@almightyfoon, can you resolve the conflicts on this PR?

@X-Guardian X-Guardian added waiting-on-response Waiting for a response from the user and removed waiting-on-review Waiting for a review from a maintainer labels Nov 5, 2024
@github-actions github-actions bot added the docs Documentation label Nov 5, 2024
@@ -221,12 +221,19 @@ func (e *VCSEventsController) handleGithubPost(w http.ResponseWriter, r *http.Re
func (e *VCSEventsController) handleBitbucketCloudPost(w http.ResponseWriter, r *http.Request) {
eventType := r.Header.Get(bitbucketEventTypeHeader)
reqID := r.Header.Get(bitbucketCloudRequestIDHeader)
sig := r.Header.Get(bitbucketServerSignatureHeader)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should bitbucketServerSignatureHeader be renamed to bitbucketSignatureHeader if it is now used by both Cloud and Server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation go Pull requests that update Go code provider/bitbucket security waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for bitbucket cloud webhook secrets
7 participants