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(platform/bitbucket): add support for Bitbucket development branching model #20860

Merged

Conversation

setchy
Copy link
Collaborator

@setchy setchy commented Mar 10, 2023

Changes

Continuation of #20803

Updates the Bitbucket Cloud repository initialization logic to fetch and set the development branch name instead of relying only on the main branch name.

Context

Closes #20802

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@setchy setchy requested review from viceice and rarkins March 10, 2023 20:46
@setchy
Copy link
Collaborator Author

setchy commented Mar 10, 2023

If memory serves correctly, there was one unresolved discussion @viceice @rarkins around should the Repository Configuration be read from

  1. main branch
  2. development branch

Having slept on it, I'm thinking that we keep the implementation as is and read from the "development branch" as configured by the repository's branching model configuration.

In a git-flow workflow, the "development branch" feels like the right place for the configuration to be pulled from since it is the "integration" branch. The "main branch" is mainly focused on keeping a record of the production releases as they occur

@rarkins
Copy link
Collaborator

rarkins commented Mar 11, 2023

So this takes up an extra API call per repo during initialization, even if the repo doesn't have the development branching model and/or uses main?

@viceice
Copy link
Member

viceice commented Mar 11, 2023

So this takes up an extra API call per repo during initialization, even if the repo doesn't have the development branching model and/or uses main?

only if the new config flag is enabled

@rarkins
Copy link
Collaborator

rarkins commented Mar 11, 2023

So this takes up an extra API call per repo during initialization, even if the repo doesn't have the development branching model and/or uses main?

only if the new config flag is enabled

I know, but I suspect most users will enable this and we'll probably switch to having it on by default in a future major release. It's a pity we can't get it with one API call but 2 isn't so bad.

setchy and others added 3 commits March 11, 2023 08:04
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
@setchy
Copy link
Collaborator Author

setchy commented Mar 11, 2023

So this takes up an extra API call per repo during initialization, even if the repo doesn't have the development branching model and/or uses main?

Unfortunately yes... I did go back and forth with Atlassian Support Engineers earlier this week to see if it was possible to retrieve this via a single API call, but no luck.

I did consider using the override_settings response values from 2.0/repositories/{{repoName}}, but it got complicated quickly and didn't really solve the problem.

 "override_settings": {
    "default_merge_strategy": true,
    "branching_model": true
}

If the repository has disabled inherit settings, then the response will contain branching_model: false, which is a signal that the repository may have a development branch configured different to main branch (but not a guarantee)
Screenshot 2023-03-11 at 8 23 57 AM

However, if inherit settings is left enabled, which is the default, then we still don't know what the Bitbucket Project branching model settings are unless we make a separate call to the Projects API, or to the Repository Branching Model API as we're doing in this PR.

Unfortunately, the two API calls aren't avoidable.

@rarkins rarkins added this pull request to the merge queue Mar 12, 2023
Merged via the queue into renovatebot:main with commit 98be25f Mar 12, 2023
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 35.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@setchy setchy deleted the feature/20802-bitbucket-development-branch branch March 17, 2023 15:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2023
@setchy setchy added platform:bitbucket Bitbucket Cloud platform type:feature Feature (new functionality) labels May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform:bitbucket Bitbucket Cloud platform type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bitbucket Cloud: initialize repos with development branch
4 participants