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

Add GetDefaultBranch Endpoint in Git Service #475

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zakisk
Copy link

@zakisk zakisk commented Dec 29, 2024

Users should be able to fetch Default branch for a repository. This PR implements GetDefaultBranch for following git providers:

  • Azure DevOps
  • Bitbucket Cloud
  • Gitea
  • GitHub
  • GitLab
  • Gogs
  • Bitbucket Server (AKA Stash)

@jenkins-x-bot
Copy link

Hi @zakisk. Thanks for your PR.

I'm waiting for a jenkins-x member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.

@jenkins-x-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign skisocks
You can assign the PR to them by writing /assign @skisocks in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@msvticket
Copy link
Member

You can already get the same information with another method. I don't think it's worthwhile to burden the API with a separate method.

@zakisk
Copy link
Author

zakisk commented Dec 30, 2024

You can already get the same information with another method. I don't think it's worthwhile to burden the API with a separate method.

@msvticket yes, but what if user wants other details of default branch, like in our use case we want default branch's latestCommit.

@zakisk zakisk force-pushed the add-get-default-branch-endpoint branch from b951a01 to f9637c4 Compare December 30, 2024 10:20
@zakisk
Copy link
Author

zakisk commented Dec 30, 2024

and FindRef endpoint also doesn't able to do this.

@zakisk
Copy link
Author

zakisk commented Jan 3, 2025

@msvticket yes, but what if user wants other details of default branch, like in our use case we want default branch's latestCommit.

@msvticket what do you think?

@chmouel
Copy link

chmouel commented Jan 3, 2025

if you are adding a new method across all interfaces just for the bitbucket server use case it would be fair to add the implementation for the others providers or at least the one that should be trivial to do (from pac implementation) ie: bbcloud/github/gilab/gogs

@msvticket
Copy link
Member

and FindRef endpoint also doesn't able to do this.

What do you mean? Don't you get the commit sha from FindBranch?

@zakisk
Copy link
Author

zakisk commented Jan 3, 2025

What do you mean? Don't you get the commit sha from FindBranch?

if I pass default in argument to FindRef it doesn't returns default branch of the repository, so if I want to know the name of default branch FindRef can't help.

@zakisk zakisk force-pushed the add-get-default-branch-endpoint branch from f9637c4 to f505d76 Compare January 3, 2025 14:12
@msvticket
Copy link
Member

What do you mean? Don't you get the commit sha from FindBranch?

if I pass default in argument to FindRef it doesn't returns default branch of the repository, so if I want to know the name of default branch FindRef can't help.

But you can look up the default branch first, so it can be done already. But If you do implement the method for other suppliers (as mentioned above) I could approve this PR.

@zakisk
Copy link
Author

zakisk commented Jan 3, 2025

it can be done already

How? Are you referring FindRepository endpoint which I patched?

@zakisk
Copy link
Author

zakisk commented Jan 3, 2025

But If you do implement the method for other suppliers

Sure!

@msvticket
Copy link
Member

it can be done already

How? Are you referring FindRepository endpoint which I patched?

Yeah

@zakisk
Copy link
Author

zakisk commented Jan 4, 2025

But If you do implement the method for other suppliers

Sure!

@msvticket can you please make it /ok-to-test?

@msvticket
Copy link
Member

/ok-to-test

@zakisk
Copy link
Author

zakisk commented Jan 4, 2025

/ok-to-test

Thanks!

@zakisk
Copy link
Author

zakisk commented Jan 7, 2025

@msvticket can you please approve as well?

@msvticket
Copy link
Member

@msvticket can you please approve as well?

As discussed above you would need to add implementations for other suppliers as well first.

@zakisk
Copy link
Author

zakisk commented Jan 8, 2025

@msvticket can you please approve as well?

As discussed above you would need to add implementations for other suppliers as well first.

Ohhh, my bad I thought that you wanted it in separate PRs. Okay I am gonna add for others.

added GetDefaultBranch endpoint in git service for
Bitbucket server and its unit tests.

Signed-off-by: Zaki Shaikh <[email protected]>
@zakisk zakisk force-pushed the add-get-default-branch-endpoint branch from f505d76 to f637e00 Compare January 8, 2025 09:40
@zakisk zakisk changed the title Add GetDefaultBranch Endpoint in Git Service for Bitbucket Server (stash) Add GetDefaultBranch Endpoint in Git Service Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants