konstructio / kubefirst

The Kubefirst Open Source Platform
https://kubefirst.konstruct.io/docs
MIT License
1.79k stars 140 forks source link

Bug: Using the Gitops-template repository in private conditions #1553

Open PatrickLaabs opened 1 year ago

PatrickLaabs commented 1 year ago

Which version of kubefirst are you using?

v2.0.8

Which installation type?

k3d (local)

Which distributed Git provider?

GitHub

What is the issue?

(This is not about the already known issue #1548)

Currently, if a user wants to work with it's own gitops-template repository, the user has to either fork or clone the repository. Forking the gitops-template repository forces the user to keep the repo publicly visible and also available.

If one may decide to switch the visibility to private, the user has to clone the repo, and add the needed tag (See #1548).

The "Problem": Using a private gitops-template repo will fail, since the kubefirst cli is not able to access the repo, even if the github_token environment variable is set and valid.

Since I don't know if this is a bug, or not: This Issue might be also a feature / improvement request.

Snippets from the log:

2023-05-19T15:41 INF cmd/k3d/create.go:335 > cloning gitops-template repo branch: v2.0.8
2023-05-19T15:41 INF cmd/k3d/create.go:346 > checking authentication to required providers
2023-05-19T15:41 INF cmd/k3d/create.go:398 > already completed github checks - continuing
2023-05-19T15:41 INF cmd/k3d/create.go:426 > already setup kbot user - continuing
2023-05-19T15:41 INF cmd/k3d/create.go:430 > validation and kubefirst cli environment check is complete
2023-05-19T15:41 INF pkg/helpers.go:43 > original domain name: kubefirst.dev
2023-05-19T15:41 INF pkg/helpers.go:49 > adjusted domain name:  kubefirst.dev
2023-05-19T15:41 INF pkg/helpers.go:43 > original domain name: kubefirst.dev
2023-05-19T15:41 INF pkg/helpers.go:49 > adjusted domain name:  kubefirst.dev
2023-05-19T15:41 INF cmd/k3d/create.go:489 > already completed download of dependencies to `$HOME/.k1/tools` - continuing
2023-05-19T15:41 INF cmd/k3d/create.go:509 > generating your new gitops repository
2023-05-19T15:41 INF pkg/gitClient/git.go:49 > cloning url: git@github.com:PatrickLaabs/gitops-template.git - git ref: v2.0.8
2023-05-19T15:41 INF pkg/k3d/create.go:88 > error opening repo at: /home/patrick/.k1/gitops
2023-05-19T15:41 INF pkg/k3d/create.go:90 > gitops repository clone complete
2023-05-19T15:41 INF pkg/k3d/adjustContent.go:51 > Error populating gitops repository with driver content: k3d-github. error: lstat /home/patrick/.k1/gitops/k3d-github/: no such file or directory

Code of Conduct

fharper commented 1 year ago

Sorry, we missed that issue.

It's probably a bug, maybe the CLI isn't using the token for fetching the gitops-template repository. It should work though if you provide a token with proper access. I don't think we tested this user case, we'll give it a closer look, thanks for the report.

fharper commented 1 year ago

I can reproduce the issue, let me check with the engineering team.

alechp commented 3 months ago

Confirming this issue still exists:

Screenshot 2024-06-28 at 3 42 39 PM
{"level":"error","time":"2024-06-28T22:31:07Z","message":"error cloning repo (https://github.com/capswan/gitops-template) at: /root/.k1/cscloud/gitops, err: authentication required"}
{"level":"panic","time":"2024-06-28T22:31:07Z","message":"error opening repo at: /root/.k1/cscloud/gitops, err: authentication required"}
{"level":"info","time":"2024-06-28T15:31:10-07:00","message":"unable to get cluster 500 Internal Server Error, continuing"}
{"level":"info","time":"2024-06-28T15:31:20-07:00","message":"unable to get cluster 500 Internal Server Error, continuing"}