2016-04-09 06:41:21 +08:00
|
|
|
# Developers Guide
|
|
|
|
|
|
|
|
This guide explains how to set up your environment for developing on
|
2018-10-19 01:30:39 +08:00
|
|
|
Helm.
|
2016-04-09 06:41:21 +08:00
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
2017-09-30 05:26:43 +08:00
|
|
|
- The latest version of Go
|
2018-04-24 03:47:02 +08:00
|
|
|
- The latest version of Dep
|
2017-09-30 05:26:43 +08:00
|
|
|
- A Kubernetes cluster w/ kubectl (optional)
|
2017-04-28 19:11:51 +08:00
|
|
|
- Git
|
2016-04-12 03:26:33 +08:00
|
|
|
|
2018-10-19 01:30:39 +08:00
|
|
|
## Building Helm
|
2016-04-27 05:49:15 +08:00
|
|
|
|
|
|
|
We use Make to build our programs. The simplest way to get started is:
|
|
|
|
|
|
|
|
```console
|
2019-06-13 16:24:50 +08:00
|
|
|
$ make
|
2016-04-27 05:49:15 +08:00
|
|
|
```
|
|
|
|
|
2019-03-13 07:06:06 +08:00
|
|
|
NOTE: This will fail if not running from the path `$GOPATH/src/helm.sh/helm`. The
|
2019-04-27 03:27:00 +08:00
|
|
|
directory `helm.sh` should not be a symlink or `build` will not find the relevant
|
2017-10-01 17:03:38 +08:00
|
|
|
packages.
|
2017-04-11 03:31:08 +08:00
|
|
|
|
2019-06-13 16:24:50 +08:00
|
|
|
If required, this will first install dependencies, rebuild the `vendor/` tree, and
|
|
|
|
validate configuration. It will then compile `helm` and place it in `bin/helm`.
|
2016-04-27 05:49:15 +08:00
|
|
|
|
2018-02-05 13:38:22 +08:00
|
|
|
To run all the tests (without running the tests for `vendor/`), run
|
2016-04-27 05:49:15 +08:00
|
|
|
`make test`.
|
|
|
|
|
2018-10-19 01:30:39 +08:00
|
|
|
To run Helm locally, you can run `bin/helm`.
|
2016-04-27 05:49:15 +08:00
|
|
|
|
2019-06-13 16:24:50 +08:00
|
|
|
- Helm is known to run on macOS and most Linux distributions, including Alpine.
|
2016-04-27 05:49:15 +08:00
|
|
|
|
2016-11-01 07:11:31 +08:00
|
|
|
### Man pages
|
|
|
|
|
2019-04-01 18:31:32 +08:00
|
|
|
Man pages and Markdown documentation are not pre-built in `docs/` but you can
|
|
|
|
generate the documentation using `make docs`.
|
2016-11-01 07:11:31 +08:00
|
|
|
|
|
|
|
To expose the Helm man pages to your `man` client, you can put the files in your
|
|
|
|
`$MANPATH`:
|
|
|
|
|
|
|
|
```
|
2019-03-13 07:06:06 +08:00
|
|
|
$ export MANPATH=$GOPATH/src/helm.sh/helm/docs/man:$MANPATH
|
2016-11-01 07:11:31 +08:00
|
|
|
$ man helm
|
|
|
|
```
|
|
|
|
|
2016-04-27 05:49:15 +08:00
|
|
|
|
|
|
|
## Docker Images
|
|
|
|
|
2016-06-21 03:59:49 +08:00
|
|
|
To build Docker images, use `make docker-build`.
|
|
|
|
|
|
|
|
Pre-build images are already available in the official Kubernetes Helm
|
|
|
|
GCR registry.
|
2016-04-27 05:49:15 +08:00
|
|
|
|
|
|
|
## Running a Local Cluster
|
|
|
|
|
2016-08-09 06:41:21 +08:00
|
|
|
For development, we highly recommend using the
|
|
|
|
[Kubernetes Minikube](https://github.com/kubernetes/minikube)
|
2018-10-19 01:30:39 +08:00
|
|
|
developer-oriented distribution.
|
2016-06-21 03:59:49 +08:00
|
|
|
|
2016-04-27 05:49:15 +08:00
|
|
|
## Contribution Guidelines
|
|
|
|
|
|
|
|
We welcome contributions. This project has set up some guidelines in
|
|
|
|
order to ensure that (a) code quality remains high, (b) the project
|
|
|
|
remains consistent, and (c) contributions follow the open source legal
|
|
|
|
requirements. Our intent is not to burden contributors, but to build
|
|
|
|
elegant and high-quality open source code so that our users will benefit.
|
|
|
|
|
2016-04-28 23:51:01 +08:00
|
|
|
Make sure you have read and understood the main CONTRIBUTING guide:
|
|
|
|
|
2018-11-29 02:08:38 +08:00
|
|
|
https://github.com/helm/helm/blob/master/CONTRIBUTING.md
|
2016-04-28 23:51:01 +08:00
|
|
|
|
2016-10-15 05:51:24 +08:00
|
|
|
### Structure of the Code
|
|
|
|
|
|
|
|
The code for the Helm project is organized as follows:
|
|
|
|
|
|
|
|
- The individual programs are located in `cmd/`. Code inside of `cmd/`
|
|
|
|
is not designed for library re-use.
|
|
|
|
- Shared libraries are stored in `pkg/`.
|
|
|
|
- The `scripts/` directory contains a number of utility scripts. Most of these
|
|
|
|
are used by the CI/CD pipeline.
|
|
|
|
- The `docs/` folder is used for documentation and examples.
|
|
|
|
|
|
|
|
Go dependencies are managed with
|
2018-04-24 03:47:02 +08:00
|
|
|
[Dep](https://github.com/golang/dep) and stored in the
|
2016-10-15 05:51:24 +08:00
|
|
|
`vendor/` directory.
|
|
|
|
|
2016-06-21 03:59:49 +08:00
|
|
|
### Git Conventions
|
|
|
|
|
|
|
|
We use Git for our version control system. The `master` branch is the
|
|
|
|
home of the current development candidate. Releases are tagged.
|
|
|
|
|
|
|
|
We accept changes to the code via GitHub Pull Requests (PRs). One
|
|
|
|
workflow for doing this is as follows:
|
|
|
|
|
2019-04-27 03:27:00 +08:00
|
|
|
1. Go to your `$GOPATH/src` directory, then `mkdir helm.sh; cd helm.sh` and `git clone` the
|
2019-03-06 03:57:39 +08:00
|
|
|
`github.com/helm/helm` repository.
|
2016-06-21 03:59:49 +08:00
|
|
|
2. Fork that repository into your GitHub account
|
2019-03-13 07:06:06 +08:00
|
|
|
3. Add your repository as a remote for `$GOPATH/src/helm.sh/helm`
|
2016-06-21 03:59:49 +08:00
|
|
|
4. Create a new working branch (`git checkout -b feat/my-feature`) and
|
|
|
|
do your work on that branch.
|
|
|
|
5. When you are ready for us to review, push your branch to GitHub, and
|
|
|
|
then open a new pull request with us.
|
|
|
|
|
|
|
|
For Git commit messages, we follow the [Semantic Commit Messages](http://karma-runner.github.io/0.13/dev/git-commit-msg.html):
|
|
|
|
|
|
|
|
```
|
|
|
|
fix(helm): add --foo flag to 'helm install'
|
|
|
|
|
|
|
|
When 'helm install --foo bar' is run, this will print "foo" in the
|
|
|
|
output regardless of the outcome of the installation.
|
|
|
|
|
|
|
|
Closes #1234
|
|
|
|
```
|
|
|
|
|
|
|
|
Common commit types:
|
|
|
|
|
|
|
|
- fix: Fix a bug or error
|
|
|
|
- feat: Add a new feature
|
|
|
|
- docs: Change documentation
|
|
|
|
- test: Improve testing
|
2017-05-12 05:20:06 +08:00
|
|
|
- ref: refactor existing code
|
2016-06-21 03:59:49 +08:00
|
|
|
|
|
|
|
Common scopes:
|
|
|
|
|
|
|
|
- helm: The Helm CLI
|
|
|
|
- pkg/lint: The lint package. Follow a similar convention for any
|
2016-10-15 05:51:24 +08:00
|
|
|
package
|
2016-06-21 03:59:49 +08:00
|
|
|
- `*`: two or more scopes
|
|
|
|
|
|
|
|
Read more:
|
|
|
|
- The [Deis Guidelines](https://github.com/deis/workflow/blob/master/src/contributing/submitting-a-pull-request.md)
|
|
|
|
were the inspiration for this section.
|
|
|
|
- Karma Runner [defines](http://karma-runner.github.io/0.13/dev/git-commit-msg.html) the semantic commit message idea.
|
|
|
|
|
|
|
|
### Go Conventions
|
|
|
|
|
|
|
|
We follow the Go coding style standards very closely. Typically, running
|
|
|
|
`go fmt` will make your code beautiful for you.
|
|
|
|
|
|
|
|
We also typically follow the conventions recommended by `go lint` and
|
2016-10-15 05:51:24 +08:00
|
|
|
`gometalinter`. Run `make test-style` to test the style conformance.
|
2016-06-21 03:59:49 +08:00
|
|
|
|
|
|
|
Read more:
|
|
|
|
|
|
|
|
- Effective Go [introduces formatting](https://golang.org/doc/effective_go.html#formatting).
|
|
|
|
- The Go Wiki has a great article on [formatting](https://github.com/golang/go/wiki/CodeReviewComments).
|