Follow the "Run from source code" section on README.
You can't create a new branch our repository directly. Please fork our repository on your account to modify.
Please check this document to make sure your commits are signed. Our repository can't accept unsigned commits.
Run the following shell command to setup Git hook. It runs format or lint codes before commiting changes.
$ make setup-hooks
Save the following code as .vscode/launch.json
.
{
"version": "0.2.0",
"configurations": [
{
"name": "Start KHI Backend",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "./cmd/kubernetes-history-inspector/",
"cwd": "${workspaceFolder}",
"args": [
"--host",
"127.0.0.1",
"--port",
"8080",
"--frontend-asset-folder",
"./dist",
],
"dlvLoadConfig": {
"followPointers": true,
"maxVariableRecurse": 1,
"maxStringLen": 100000,
"maxArrayValues": 64,
"maxStructFields": -1
},
}
],
}
You can run the server with VSCode. You can refer this document for more details.
To develop frontend code, we usually start Angular dev server on port 4200 with the following code.
$ make watch-web
This will build the frontend code with the configuration to access APIs on localhost:8080
.
You can use KHI with accessing localhost:4200
instead of localhost:8080
. Angular dev server automatically build and serve the new build when you change the frontend code.
Run the following code to verify frontend and backend codes.
$ make test
When you want to run backend tests without Cloud Logging, run the following code.
$ go test ./... -args -skip-cloud-logging=true
Several frontend codes are automativally generated from backend codes.
/web/src/app/generated.sass
/web/src/app/generated.ts
These files are generated with scripts/frontend-codegen/main.go
Golang codes. It reads several Golang constant arrays and generate frontend codes with templates.