velad/docs/contribute.md

2.0 KiB

Contribution Guide

This guild helps you get started developing VelaD

Prerequisites

  1. Golang version 1.19+
  2. Docker (for non-linux user)
  3. golangci-lint 1.38.0+, it will install automatically if you run make, you can install it manually if the installation is too slow.

Build

  1. Clone this project
git clone https://github.com/kubevela/velad.git
cd velad
  1. Build VelaD
make

This will build the VelaD version corresponding to your machines architecture and OS by default. To cross build other version, you can the target. For example, you can build a darwin-amd64 version by:

make darwin-amd64

Debug

When use IDE to debug VelaD, you need to do several things

  1. Download resources needed

If you want build linux version, run

VELAUX_VERSION=v1.x.y VELA_VERSION=v1.z.w make download_vela_images_addons 
make download_k3s_bin_script 
make download_k3s_images

If you want to build non-linux version, run

VELAUX_VERSION=v1.x.y VELA_VERSION=v1.z.w make download_vela_images_addons 
make download_k3d 
make download_k3s_images

VELAUX_VERSION=v1.x.y VELA_VERSION=v1.z.w is optional environment variables if you want to change the default version in makefile.

  1. Build VelaD

If you are using macOS with intel chip, the complete build command is like:

OS=darwin ARCH=amd64 \
go build -ldflags="-X github.com/oam-dev/velad/version.VelaVersion=v1.x.y -X github.com/oam-dev/velad/version.VelaUXVersion=v1.x.y"  \
-o bin/velad \
cmd/velad/main.go

Ldflags can help to inject vela-core and VelaUX version. (Can be different) If you are using IDE to debug, remember to add -ldflags="-X github.com... part to build option.

Create a pull request

Before you submit a PR, run this command to ensure it is ready:

make reviewable

For other PR things you can check the document here.