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

docs: update the local testing to reflect latest changes in the process #2263

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,37 @@ A [.devcontainer](https://containers.dev/) configuration is provided to allow fo

### Local development

#### The CLI

Kubefirst is created using the [Go Programming Language](https://go.dev). To set up your computer, follow [these steps](https://go.dev/doc/install).

Once Go is installed, you can run Kubefirst from any branch using `go run .`. Go will automatically install the needed modules listed in the [go.mod](go.mod) file. As an example, if you want to create a [local cluster](https://docs.kubefirst.io/kubefirst/local/install.html), the command would be `go run . k3d create`. Note that even if you run kubefirst from `main`, the [gitops-template](https://github.com/kubefirst/gitops-template) version used will be the [latest release](https://github.com/kubefirst/gitops-template/releases). If you also want to use the latest from `main` for the template also, you need to run to use the `--gitops-template-url`, and the `--gitops-template-branch` as follow:
Once Go is installed, you can run Kubefirst from any branch using `go run .`. Go will automatically install the needed modules listed in the [go.mod](go.mod) file. Since Go is a compiled programming language, every time you use the `run` command, Go will compile the code before running it. If you want to save time, you can compile your code using `go build`, which will generate a file named `kubefirst`. You will then be able to run your compiled version with the `./kubefirst` command.

If you want to create a [Civo cluster](https://docs.kubefirst.io/kubefirst/local/install.html), the command would be `go run . civo create`.

#### GitOps Template

Note that even if you run kubefirst from `main`, the [gitops-template](https://github.com/kubefirst/gitops-template) version used will be the [latest release](https://github.com/kubefirst/gitops-template/releases). If you also want to use the latest from `main` for the template, you need to run to use the `--gitops-template-url`, and the `--gitops-template-branch` as follow:

```shell
go run . civo create --gitops-template-url https://github.com/kubefirst/gitops-template --gitops-template-branch main
```

#### Kubefirst API

If you need to use a specific branch or latest from `main` that wasn't released yet for the [kubefirst-api](https://github.com/kubefirst/kubefirst-api) repository, you will need to first run it locally as described in [its documentation](https://github.com/kubefirst/kubefirst-api#running-locally). You will also need to run the code from [console](https://github.com/kubefirst/console) repository, whether you need to use a specific version of the code or not, as we don't expose the API directly. To do so, follow the [instructions in its README](https://github.com/kubefirst/console#setup-instructions). Before running the CLI as mentionned "The CLI" section, you need to export a local variable:

```shell
go run . k3d create --gitops-template-url https://github.com/kubefirst/gitops-template --gitops-template-branch main
export K1_CONSOLE_REMOTE_URL="http://localhost:3000"
fharper marked this conversation as resolved.
Show resolved Hide resolved
```

The previous steps will work for all clouds except k3d which use our runtime for now: we have plan to remove this dependencies completely and use the API also to make the code easier to maintain, and less prone to issues. For that step, instead of running the API, and console locally, you simply need to clone the [kubefirst-api](https://github.com/kubefirst/kubefirst-api) repository locally, and add the following line in the `go.mod` file:

```go
github.com/kubefirst/kubefirst-api vX.X.XX => /path-to/kubefirst-api/
```

Since Go is a compiled programming language, every time you use the `run` command, Go will compile the code before running it. If you want to save time, you can compile your code using `go build`, which will generate a file named `kubefirst`. You will then be able to run your compiled version with the `./kubefirst` command.
Replace `vX.X.XX` with the latest version used in the mode file for the API, and the `/path-to/kubefirst-api/` with the path to the folder of your locally Kubefirst API folder.

## Getting Started with the Documentation

Expand Down
Loading