Skip to content

feat(scm): add bitbucket cloud scm and action support#2847

Merged
olblak merged 9 commits into
updatecli:mainfrom
mcwarman:feat/bitbucket
Oct 23, 2024
Merged

feat(scm): add bitbucket cloud scm and action support#2847
olblak merged 9 commits into
updatecli:mainfrom
mcwarman:feat/bitbucket

Conversation

@mcwarman

Copy link
Copy Markdown
Member

Add support for Bitbucket Cloud:

  • a new scm bitbucket
  • a new action bitbucket/pullrequest

Also updates documentation for stash to make it clearer its Bitbucket Server.

Test

To test this pull request, you can run the following commands:

go build -o bin/updatecli
./bin/updatecli diff --config ./e2e/updatecli.d/success.d/bitbucket/scm.yaml

Additional Information

Tradeoff

Bitbucket doesn't support any HTML in PR descriptions, so I had to add Markdown only views. There's a potential the format could be improved going forward

Potential improvement

Markdown format of PRs.

@mcwarman mcwarman requested a review from olblak October 18, 2024 15:35
@mcwarman

Copy link
Copy Markdown
Member Author

@olblak if you want to set-up a repo in bitbucket that you control, I'm happy to update the e2e tests to use that instead.

@mcwarman mcwarman changed the title feat: add bitbucket cloud scm and action support feat(scm): add bitbucket cloud scm and action support Oct 18, 2024
@olblak

olblak commented Oct 19, 2024

Copy link
Copy Markdown
Member

Ho nice

Bitbucket doesn't support any HTML in PR descriptions, so I had to add Markdown only views. There's a potential the format could be improved going forward

It's unfortunate because using HTML allows Updatecli to store information in

so it can detect when a pullrequest body needs to be updated.

if you want to set-up a repo in bitbucket that you control, I'm happy to update the e2e tests to use that instead.

I think it would make sense to create a shared bitbucket instance as we can have up to 5 seats
https://www.atlassian.com/software/bitbucket/pricing

@mcwarman

mcwarman commented Oct 19, 2024

Copy link
Copy Markdown
Member Author

It's unfortunate because using HTML allows Updatecli to store information in
so it can detect when a pullrequest body needs to be updated.

Yeah I've started using Bitbucket in my new role, its not my favourite user experience.

It also doesn't support HTML comments so we couldn't get clever with hiding information in them either.

@olblak

olblak commented Oct 22, 2024

Copy link
Copy Markdown
Member

@mcwarman I just open a pullrequest on your fork, to update the e2e tests
mcwarman#1

Apparently, I already created a Bitbucket account, and we can have up to 5 people on that workspace

@olblak

olblak commented Oct 22, 2024

Copy link
Copy Markdown
Member

I just tested this pullrequest and it seems to work great 🎉

https://bitbucket.org/updatecli/updatecli/pull-requests/2

@olblak

olblak commented Oct 22, 2024

Copy link
Copy Markdown
Member

Could I ask to also add a documentation page to the website next to https://github.com/updatecli/website/tree/master/content/en/docs/plugins/scm

@mcwarman

Copy link
Copy Markdown
Member Author

I don't have access to see that repo on bitbucket (if you added mcwarman that's an old work account I can't get back the username for mcwarman1 is now me).

I'll add the docs for using it.

@mcwarman

Copy link
Copy Markdown
Member Author

We either need to make the test repo public, or set BITBUCKET_TOKEN for the e2e generated from the repo:

Ref: https://support.atlassian.com/bitbucket-cloud/docs/access-tokens/

@olblak

olblak commented Oct 22, 2024

Copy link
Copy Markdown
Member

We either need to make the test repo public, or set BITBUCKET_TOKEN for the e2e generated from the repo:

Ref: https://support.atlassian.com/bitbucket-cloud/docs/access-tokens/

Well I thought it already made it public, I'll check that later

@olblak olblak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the pull request, it looks great.

@olblak olblak merged commit 5886ce7 into updatecli:main Oct 23, 2024
@olblak olblak added enhancement New feature or request scm-bitbucket All things related to the bitbucket integration labels Oct 23, 2024
@olblak olblak added this to the 0.86.0 milestone Oct 23, 2024
@mcwarman mcwarman deleted the feat/bitbucket branch October 23, 2024 07:54
roulettedares added a commit to roulettedares/updatecli that referenced this pull request Apr 24, 2026
… action

isRemoteBranchesExist() fetched all remote branches via a paginated list
scan (Page: 1, Size: 30 with no follow-through) to check whether the
source and target branches exist. On repositories with more than 30
branches this silently returned false, causing CreateAction to log
"skipping pull request creation" at Debug level and exit with nil — the
job appeared green with no PR and no visible explanation.

Replace the list scan with two direct FindBranch calls (one per branch).
This mirrors the approach used by GitHub's GraphQL implementation and is
O(1) regardless of repository branch count. A 404 response from
FindBranch is treated as a missing branch and logged at Warning level so
the failure is visible without --debug.

Also fix isPullRequestExist() which had the same Size: 30 truncation: it
now paginates using resp.Page.Next until all open pull requests have been
checked.

Fixes the same class of bug as updatecli#1905 (GitLab) which was introduced when
the Bitbucket Cloud plugin was added in updatecli#2847.
olblak added a commit that referenced this pull request Apr 25, 2026
… action (#8584)

isRemoteBranchesExist() fetched all remote branches via a paginated list
scan (Page: 1, Size: 30 with no follow-through) to check whether the
source and target branches exist. On repositories with more than 30
branches this silently returned false, causing CreateAction to log
"skipping pull request creation" at Debug level and exit with nil — the
job appeared green with no PR and no visible explanation.

Replace the list scan with two direct FindBranch calls (one per branch).
This mirrors the approach used by GitHub's GraphQL implementation and is
O(1) regardless of repository branch count. A 404 response from
FindBranch is treated as a missing branch and logged at Warning level so
the failure is visible without --debug.

Also fix isPullRequestExist() which had the same Size: 30 truncation: it
now paginates using resp.Page.Next until all open pull requests have been
checked.

Fixes the same class of bug as #1905 (GitLab) which was introduced when
the Bitbucket Cloud plugin was added in #2847.

Co-authored-by: Olivier Vernin <olivier@vernin.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scm-bitbucket All things related to the bitbucket integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants