daytonaio / daytona

The Open Source Dev Environment Manager.
https://daytona.io
Apache License 2.0
8.07k stars 768 forks source link

Webhook event support for Bitbucket Server prebuilds #995

Open idagelic opened 2 weeks ago

idagelic commented 2 weeks ago

Is your feature request related to a problem? Please describe. We should support registering webhooks to Bitbucket Server which will allow us to parse its Git events and use prebuilds.

Describe the solution you'd like An approach similar to the way GitHub webhooks are implemented should be used. The final solution should be properly tested and include screenshots of the Daytona CLI calls working correctly and the webhook being present in the dashboard of the Git provider.

Additional context This includes a webhook get, register and unregister method as well as methods for comparing commit ranges and parsing event data. The implementation should be done in the pkg/gitprovider directory and use the same endpoint as the GitHub provider.

Tpuljak commented 2 weeks ago

/bounty $50

algora-pbc[bot] commented 2 weeks ago

💎 $50 bounty • Daytona

Steps to solve:

  1. Start working: Comment /attempt #995 with your implementation plan
  2. Submit work: Create a pull request including /claim #995 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

If no one is assigned to the issue, feel free to tackle it, without confirmation from us, after registering your attempt. In the event that multiple PRs are made from different people, we will generally accept those with the cleanest code.

Please respect others by working on PRs that you are allowed to submit attempts to.

e.g. If you reached the limit of active attempts, please wait for the ability to do so before submitting a new PR.

If you can not submit an attempt, you will not receive your payout.

Thank you for contributing to daytonaio/daytona!

Add a bounty • Share on socials

Attempt Started (GMT+0) Solution
🟢 @chenshiwei-io Sep 4, 2024, 3:56:15 AM WIP
chenshiwei-io commented 1 week ago

/attempt #995

chenshiwei-io commented 6 days ago

Hello, Test the bitbucket server webhook feature need to subscribe Standard plan. I am sorry, I no have the bitbucket-server subscribed account. image

Does the project owner give a plan account?

Tpuljak commented 6 days ago

Hello, Test the bitbucket server webhook feature need to subscribe Standard plan. I am sorry, I no have the bitbucket-server subscribed account. image

Does the project owner give a plan account?

@chenshiwei-io this issue is not related to bitbucket.org but Bitbucket Server which is the self-hosted version of bitbucket.

We do not provide accounts for this.

If you do not have access to a Bitbucket Server instance, I suggest you look into other bounties. Thanks for your interest and understanding.

chenshiwei-io commented 5 days ago

Hello, Test the bitbucket server webhook feature need to subscribe Standard plan. I am sorry, I no have the bitbucket-server subscribed account. image Does the project owner give a plan account?

@chenshiwei-io this issue is not related to bitbucket.org but Bitbucket Server which is the self-hosted version of bitbucket.

We do not provide accounts for this.

If you do not have access to a Bitbucket Server instance, I suggest you look into other bounties. Thanks for your interest and understanding.

Thank your reply. I decided to deploy self-host then try again.

chenshiwei-io commented 2 days ago

When I create code use bitbucket-server provider have a problem. my action steps:

  1. image
  2. image
  3. image

these codes may have some problems, the repo URL does not use standard repo format, like GitHub repo. Why use fixed "projects" "repos" keyword?

https://github.com/daytonaio/daytona/blob/06d2cb9932df95384c8e57d98edd71c107b92a43/pkg/gitprovider/bitbucketserver.go#L415-L424

Tpuljak commented 2 days ago

these codes may have some problems, the repo URL does not use standard repo format, like GitHub repo. Why use fixed "projects" "repos" keyword?

The keywords are fixed there because you could run daytona create REPO_URL where repo url is the URL of the repo in the browser which has that format.

I think this might be a regression introduced after developing the git provider. From what I can see, we should first try to parse the context like we do now, if that fails, we should parse the clone URL which is that scm URL.

We can provide a tip if you fix this in the webhooks PR or another one which you can submit first.

chenshiwei-io commented 2 days ago

these codes may have some problems, the repo URL does not use standard repo format, like GitHub repo. Why use fixed "projects" "repos" keyword?

The keywords are fixed there because you could run daytona create REPO_URL where repo url is the URL of the repo in the browser which has that format.

I think this might be a regression introduced after developing the git provider. From what I can see, we should first try to parse the context like we do now, if that fails, we should parse the clone URL which is that scm URL.

We can provide a tip if you fix this in the webhooks PR or another one which you can submit first.

all right, I will test it first to use the browser format url.

chenshiwei-io commented 2 days ago

these codes may have some problems, the repo URL does not use standard repo format, like GitHub repo. Why use fixed "projects" "repos" keyword?

The keywords are fixed there because you could run daytona create REPO_URL where repo url is the URL of the repo in the browser which has that format. I think this might be a regression introduced after developing the git provider. From what I can see, we should first try to parse the context like we do now, if that fails, we should parse the clone URL which is that scm URL. We can provide a tip if you fix this in the webhooks PR or another one which you can submit first.

all right, I will test it first to use the browser format url.

You can give some fix tips,when I have time just do it

Tpuljak commented 2 days ago

You can give some fix tips,when I have time just do it

From what I can see, we should first try to parse the context like we do now, if that fails, we should parse the clone URL which is that scm URL.

Basically, instead of throwing an error immediately, try to parse the SCM URL with regex as well.

chenshiwei-io commented 2 days ago

You can give some fix tips,when I have time just do it

From what I can see, we should first try to parse the context like we do now, if that fails, we should parse the clone URL which is that scm URL.

Basically, instead of throwing an error immediately, try to parse the SCM URL with regex as well.

all right.