Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
Update Contributing docs for recent go changes (#58)
Browse files Browse the repository at this point in the history
As we migrate to go modules and update linter configs, I add a new page to give contributor more guidance on basic setup and development flow.

Signed-off-by: Jiaxin Shan <seedjeffwan@gmail.com>
  • Loading branch information
Jeffwan committed Mar 23, 2020
1 parent ee26860 commit e8a52d2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## Contributing

mxnet-operator uses go modules and supports both v1beta1 and v1. We suggest to use golang 1.13.x for development.
Make sure you enable `GO111MODULE`.

### Setup development environment

```shell
mkdir -p ${GOPATH}/src/github.com/kubeflow
cd ${GOPATH}/src/github.com/kubeflow
git clone https://github.com/${GITHUB_USER}/mxnet-operator.git
```

### Download go mods

Some utility modules like `code-generator` will be used in hack scripts,
it's better to download all dependencies for the first time.

```shell
go mod download
```

### Build the operator locally

```shell
go build -o mxnet-operator.v1beta1 github.com/kubeflow/mxnet-operator/cmd/mxnet-operator.v1beta1
go build -o mxnet-operator.v1 github.com/kubeflow/mxnet-operator/cmd/mxnet-operator.v1
```

### Build container image

```shell
# It requires you to build binary locally first.
docker build -t ${your_dockerhub_username}/mxnet-operator:v1 .
```

### Test Binaries locally

```shell
./mxnet-operator.v1beta1 --kubeconfig=$HOME/.kube/config
```

### Before code check-in

There're several steps to follow before you submit PR.

```shell
# Verify codegen in case you change api but for get to generate new packages.
./hack/verify-codegen.sh

# Lint codes
golangci-lint run --config=linter_config.yaml ./...
```

### Regenerate clients and apis

If you make changes under `/pkg/apis`, you probably need to regenerate clients and apis.

```shell
./hack/update-codegen.sh
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ server-76no-1

## Contributing

Please refer to the [developer_guide](https://github.com/kubeflow/tf-operator/blob/master/developer_guide.md)
Please refer to the [Contributing Document](./CONTRIBUTING.md)

## Community

Expand Down
4 changes: 3 additions & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ echo "Generating defaulters for v1"
--output-package github.com/kubeflow/mxnet-operator/pkg/apis/mxnet/v1

# Copy everything back.
cp -a "${TEMP_DIR}/${ROOT_PKG}/." "${SCRIPT_ROOT}/"
cp -a "${TEMP_DIR}/${ROOT_PKG}/." "${SCRIPT_ROOT}/"
# Clean up binaries we build for update codegen
rm ./defaulter-gen

0 comments on commit e8a52d2

Please sign in to comment.