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

[Bug]: Bitbucket Previews are not updated on push #2793

Closed
lorenzomigliorero opened this issue Jul 10, 2024 · 4 comments · Fixed by #5051
Closed

[Bug]: Bitbucket Previews are not updated on push #2793

lorenzomigliorero opened this issue Jul 10, 2024 · 4 comments · Fixed by #5051

Comments

@lorenzomigliorero
Copy link
Contributor

lorenzomigliorero commented Jul 10, 2024

Description

Pushing to a PR branch doesn't update the Preview deployment.
This is the response from /webhooks/source/bitbucket/events/manual:

{"status":"failed","message":"Nothing to do. No applications found with deploy key set, branch is '***' and Git Repository name has ***"}

Minimal Reproduction

  • Create an application with BitBucket repository as its source
  • Set up the BitBucket webhook && enable preview deployments
  • Create PR in the repo
  • Push to the PR branch
  • Preview deployment isn't updated

Version

v4.0.0-beta.307

@lorenzomigliorero lorenzomigliorero changed the title [Bug]: Bitbucket Previews aren't updated [Bug]: Bitbucket Previews don't update on push Jul 10, 2024
@lorenzomigliorero lorenzomigliorero changed the title [Bug]: Bitbucket Previews don't update on push [Bug]: Bitbucket Previews don't get updates on push Jul 10, 2024
@lorenzomigliorero lorenzomigliorero changed the title [Bug]: Bitbucket Previews don't get updates on push [Bug]: Bitbucket Previews don't get updated on push Jul 10, 2024
@lorenzomigliorero lorenzomigliorero changed the title [Bug]: Bitbucket Previews don't get updated on push [Bug]: Bitbucket Previews are not updated on push Jul 10, 2024
@Xiloe
Copy link
Contributor

Xiloe commented Jul 11, 2024

Yes, coolify doesn't support the pullrequest:updated request from bitbucket.
image

Same for Gitea, Gitlab, Github by the way, it's not a PR Preview feature (yet). You can however redeploy the PR manually on the UI and it should work just fine since it pulls from the PR's head, I'll see if I can do a PR in a few days, if it's not already done.

@lorenzomigliorero
Copy link
Contributor Author

lorenzomigliorero commented Jul 11, 2024

@Xiloe Thanks for the answer! Actually, a manual PR redeploy always fetches the HEAD instead of the PR branch (I've only tested Bitbucket private repos with deployment keys). I opened another issue here #2792.

@Xiloe
Copy link
Contributor

Xiloe commented Jul 11, 2024

I'll look at this later tomorrow, seems like it's the same issue that was going on with gitea that I fixed and got merged in version 308

IARayan added a commit to IARayan/coolify that referenced this issue Feb 1, 2025
…y replacing repo:push with pullrequest:updated in bitbucket webhook hander

Bitbucket's repo:push webhook doesn't provide the destination branch name in new commits, 
which prevents Coolify from finding the correct application to update preview deployments. 
By switching to pullrequest:updated and only processing updates due to new commits, 
we can reliably get the correct branch name that matches the Coolify application, 
ensuring preview deployments are properly updated.

- Remove repo:push event handling in favor of pullrequest:updated
- Add check to ignore PR updates not related to new commits
- Update handled_events collection to reflect new webhook strategy

Closes coollabsio#2793
@IARayan
Copy link
Contributor

IARayan commented Feb 1, 2025

The repo:push payload lacks the destination branch name, using push.changes.0.new.name instead. While this works for updates, it causes failures in preview deployments when a PR receives new commits. Coolify looks for git_branch in the applications table, but instead, it finds the source branch name, causing issues in preview deployment updates.

By also processing pullrequest:updated, we ensure that preview deployments remain in sync even when PRs are updated. However, this event triggers on multiple actions (e.g., PR title changes, reviewer updates), which results in extra redeploys. Since Coolify doesn’t store commit hashes for preview deployments, handling these extra redeploys is the best workaround for Bitbucket.

A PR is open

@andrasbacsai andrasbacsai linked a pull request Feb 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants