daytonaio / daytona

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

can't create upstream repos #1117

Open loveloki opened 4 days ago

loveloki commented 4 days ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. run daytona create <upstram>
  2. select a forked upstram repo
  3. See error

Expected behavior

Can create upstram repos.

Desktop (please complete the following information):

Additional context

the logs is this:

INFO[0132] API REQUEST                                   URI=/sample/ latency="495.477µs" method=GET status=200
INFO[0134] API REQUEST                                   URI=/gitprovider/gitlab-self-managed/namespaces latency=348.043147ms method=GET status=200
INFO[0136] API REQUEST                                   URI=/gitprovider/gitlab-self-managed/133/repositories latency=278.01691ms method=GET status=200
INFO[0138] API REQUEST                                   URI=/gitprovider/gitlab-self-managed/133/2427/branches latency=506.344116ms method=GET status=200
ERRO[0139] API ERROR                                     URI=/gitprovider/gitlab-self-managed/133/2427/pull-requests error="Error #01: failed to get repository pull requests: failed to get pull requests: GET https://<self gitlab url>/api/v4/projects/2449: 404 {message: 404 Project Not Found}\n" latency=547.718579ms method=GET status=500

Like above logs, The repo ID is 2427, but 2449 is used in the api.

And daytona create <upstream_url> have the same error.

Tpuljak commented 4 days ago

Managed to reproduce this when creating a project config from a gitlab fork and then trying to create a project from that config.

Tpuljak commented 4 days ago

Managed to reproduce this when creating a project config from a gitlab fork and then trying to create a project from that config.

Okay, this is not actually the same issue. We can disregard that here.

@loveloki If you look at how we fetch PRs here, you'll notice that we go through them and then find the source repository of the PR so we can construct the appropriate repo object. Does the upstream repo you're referring to, have PRs open that are from other repos that you might not have access to?

loveloki commented 22 hours ago

@Tpuljak yes, there are a lot of PRs in the upstream repository, and there are many contributors whose repositories I don't have access to.

But what does this have to do with building my repository?

Tpuljak commented 18 hours ago

@Tpuljak yes, there are a lot of PRs in the upstream repository, and there are many contributors whose repositories I don't have access to.

But what does this have to do with building my repository?

Okay, that seems to be the issue. Because, to list all PRs, we need to get all the source projects to correctly display the UI and to correctly construct the repo object, you need to have access to it. We will fix that in a way that, if you don't have access to that project, that PR is simply omitted from the list. We'll have it for tomorrow's release.

idagelic commented 12 hours ago

@loveloki Do you mind giving this PR a spin? We would love to push a fix for this.

To do this, you can stop your active Daytona server, clone the repo locally and check out to the branch gitlab-merge-request-access then run the server there (go run cmd/daytona/main.go serve).

Your configuration should be loaded automatically and you can try running the daytona create command