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

Creating a project from a commit URL fails if the commit is not from the default branch #701

Open
Tpuljak opened this issue Jun 20, 2024 · 16 comments
Labels
💎 Bounty bug Something isn't working never stale An issue that never goes stale

Comments

@Tpuljak
Copy link
Member

Tpuljak commented Jun 20, 2024

          There seems to be an issue with creating a project from a commit URL (e.g. http:https://localhost:3000/test/test/commit/3aabec775f9b206bfe454563ef0d441a2181fa81). I get the following error:

Screenshot 2024-06-19 at 09 49 37

Note: This commit is not from the main branch.

Originally posted by @Tpuljak in #689 (comment)

@Tpuljak Tpuljak added bug Something isn't working never stale An issue that never goes stale backlog backlog until further notice labels Jun 20, 2024
@Tpuljak
Copy link
Member Author

Tpuljak commented Jun 20, 2024

The issue is cause by https://github.com/daytonaio/daytona/blob/main/pkg/git/service.go#L48

Because we clone only the default branch, the checkout fails because the commit is not present in the current git tree.
I suggest that we address this by first checking to which branch does the commit belong to and then cloning that branch first.

@idagelic idagelic removed the backlog backlog until further notice label Jul 17, 2024
@idagelic
Copy link
Member

/bounty $100

Copy link

algora-pbc bot commented Jul 17, 2024

💎 $100 bounty • Daytona

Steps to solve:

  1. Start working: Comment /attempt #701 with your implementation plan
  2. Submit work: Create a pull request including /claim #701 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 bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @ologbonowiwi Jul 19, 2024, 5:41:07 PM WIP
🟢 @the-johnwick Jul 23, 2024, 10:05:32 AM #873

@ologbonowiwi
Copy link

ologbonowiwi commented Jul 19, 2024

This appears to be interesting. /attempt #701

Algora profile Completed bounties Tech Active attempts Options
@ologbonowiwi 51 bounties from 6 projects
Rust, TypeScript,
Shell & more
Cancel attempt

@ologbonowiwi
Copy link

Running the same command, daytona create http:https://localhost:3000/test/test/commit/3aabec775f9b206bfe454563ef0d441a2181fa81 -t local I got a different error:

FATA[0000] failed to get git provider for url: git provider not found
exit status 1

I could also generate other errors using github URLs, but not the error mentioned in the issue. Can you folks give me a hand in reproducing this?

@Tpuljak
Copy link
Member Author

Tpuljak commented Jul 22, 2024

Hi @ologbonowiwi, the URL provided in the issue was just an example.

You can test this properly by running daytona create https://github.com/daytonaio/daytona/commit/f7a4bf46417f0c7fc2e08eeb4f25c27235778a08

This should create the project on a branch and you'll notice that it creates it on main.

@the-johnwick
Copy link

the-johnwick commented Jul 23, 2024

@Tpuljak @ologbonowiwi Is this happening with gitness or all git providers ?

@ologbonowiwi
Copy link

Not sure.

I've tried multiple github links (including the one provided on the comment above and some of my own repos) but I got a different error complaining about not being a tree (instead of this object not found), so technically I wasn't able to reproduce it.

@Tpuljak
Copy link
Member Author

Tpuljak commented Jul 23, 2024

@Tpuljak @ologbonowiwi Is this happening with gitness or all git providers ?

@the-johnwick it's happening for all git providers

I've tried multiple github links (including the one provided on the comment above and some of my own repos) but I got a different error complaining about not being a tree (instead of this object not found), so technically I wasn't able to reproduce it.

That's the issue 😄

Git providers might have different error messages but all of that should be solved as part of this issue.

@the-johnwick
Copy link

the-johnwick commented Jul 23, 2024

@Tpuljak Oh, I got it now. I have completed the work for #763 please review it. Till then I will solve this issue.
/attempt #701

Algora profile Completed bounties Tech Active attempts Options
@the-johnwick 1 bounty from 1 project
Cancel attempt

@Tpuljak
Copy link
Member Author

Tpuljak commented Jul 23, 2024

@the-johnwick no need to tag us for reviews. We see everything going on in the repo.
You are welcome to start working on this right away. We can not guarantee when we will review the AWS PR.

@the-johnwick
Copy link

@the-johnwick no need to tag us for reviews. We see everything going on in the repo.
You are welcome to start working on this right away. We can not guarantee when we will review the AWS PR.

No problem. I thought you guys will not allow me to work on second issue since I have one pr opened. I will start working on it.

@the-johnwick
Copy link

the-johnwick commented Jul 30, 2024

The issue is cause by https://github.com/daytonaio/daytona/blob/main/pkg/git/service.go#L48

Because we clone only the default branch, the checkout fails because the commit is not present in the current git tree.
I suggest that we address this by first checking to which branch does the commit belong to and then cloning that branch first.

@Tpuljak I tried suggested approach, but it seems clone functions is not get invoked.

@Tpuljak
Copy link
Member Author

Tpuljak commented Jul 31, 2024

@the-johnwick this issue is a bit older and we refactored how the repo gets cloned in the meantime.

The clone function I mentioned there is now ignored because the project is cloned beforehand. You can check out the creation process here https://github.com/daytonaio/daytona/blob/main/pkg/docker/create.go.

In order to test changes made in the docker lib, you can refer to this PR that will add a README into the package directory.

If you have any trouble testing this, let me know.

@the-johnwick
Copy link

@the-johnwick this issue is a bit older and we refactored how the repo gets cloned in the meantime.

The clone function I mentioned there is now ignored because the project is cloned beforehand. You can check out the creation process here https://github.com/daytonaio/daytona/blob/main/pkg/docker/create.go.

In order to test changes made in the docker lib, you can refer to this PR that will add a README into the package directory.

If you have any trouble testing this, let me know.

@Tpuljak Thanks

Copy link

algora-pbc bot commented Jul 31, 2024

💡 @the-johnwick submitted a pull request that claims the bounty. You can visit your bounty board to reward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💎 Bounty bug Something isn't working never stale An issue that never goes stale
Projects
None yet
Development

No branches or pull requests

4 participants