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

Incorrect Self hosted BitBucket PR URL #2914

Open
smaldored opened this issue Jan 3, 2024 · 3 comments
Open

Incorrect Self hosted BitBucket PR URL #2914

smaldored opened this issue Jan 3, 2024 · 3 comments

Comments

@smaldored
Copy link

Hey there,

I am pretty new to using git-town, but I believe I have it set up correctly. git hack, git sync works. git propose works up until the URL it creates for the PR.

We have a self hosted Bitbucket server where our repos stay.

Here is the URL git propose creates:
open https://stash.company.local/project/repo/pull-requests/new?source=git-town-test&dest=project%2Frepo%3Adev

But, this is an invalid URL.

It needs to look like this:
open http://stash.company.local/projects/project/repos/repo/pull-requests?create&targetBranch=dev&sourceBranch=git-town-test
Notice http instead of https, /projects, /repos, ?create instead of /new?, sourceBranch instead of source, targetBranch instead of dest

Here is what I get when running git config --get-regexp git-town :

git-town.code-hosting-platform bitbucket

Do I need to use git-town.code-hosting-origin-hostname=<hostname> for something? Is there some sort of configuration I am missing?

I've come across #1164 which seems like it is a similar issue to what I am seeing.

Thanks for the help in advance

@kevgo
Copy link
Contributor

kevgo commented Jan 3, 2024

Thanks for reaching out. Your configuration looks okay to me. The issue seems that different BitBucket versions use different URLs for creating pull requests. Support for distinguishing different BitBucket versions would have to be added to Git Town.

To create pull requests on BitBucket, Git Town uses the URL reported by one of our users: #2019. If this URL doesn't work for you, I suspect you work with a different version of BitBucket and your version uses a different URL for creating pull requests. Which BitBucket version do you work with?

git-town.code-hosting-origin-hostname=<hostname> is for when you use different SSH identities. See https://www.git-town.com/preferences/code-hosting-origin-hostname for details. In your case, Git Town already correctly uses stash.company.local as the hostname, so your configuration seems okay.

To make this work for you, it seems like we would need to add a bitbucket_version configuration setting that makes Git Town use the right URL for the bitbucket version. This feature doesn't exist yet.

@smaldored
Copy link
Author

Thanks for getting back to me.

It looks like we are using Atlassian Bitbucket v7.4.1 and Bitbucket Server. From the looks of #2019 that is for the Bitbucket Cloud.

See https://developer.atlassian.com/server/bitbucket/rest/v815/api-group-pull-requests/#api-api-latest-projects-projectkey-repos-repositoryslug-pull-requests-post for creating a PR with bitbucket server API.

@kevgo
Copy link
Contributor

kevgo commented Jan 4, 2024

Interesting that BitBucket Cloud has such a different URL structure compared to the self-hosted product. Since Atlassian is moving to cloud-only, I'm a bit hesitant to invest bandwidth into adding support for the deprecated self-hosting product. But I would accept a pull request that adds it. Is your organization considering moving to the cloud offering?

Thanks for the link to the API. Git Town intentionally doesn't create pull requests via the API. Doing so would mean Git Town needs to provide a UI for the user to enter all the PR data (title and description, tag reviewers, link tickets, etc) on the command line. For each of the supported hosting services (BitBucket, Github, GitLab, Gitea). It's more ergonomic to let our users use the web-based page that they are used to. The web page is maintained by the hosting provider and offers all the PR features that the hosting provider supports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants