Thank you for taking the time to contribute to ksonnet! Before you submit any PRs, we encourage you to read the instructions for the developer certificate of origin (DCO), as well as the guidelines below:
Ensure that you already have (1) a proper
$GOPATH
and (2) ksonnet installed. If not, follow these README instructions to get set up.
To build ksonnet locally (e.g. for open-source development), run the following in the root of your ksonnet repo (which is $GOPATH/src/github.com/ksonnet/ksonnet
unless otherwise specified):
make all
This indirectly makes the following targets:
* `make ks` - Compiles all the code into a local `ks` binary
* `make docs` - Regenerates all the documentation for the ksonnet CLI, based on the code inside `cmd/`.
make docs
relies on the realpath
Linux utility. If you encounter a realpath: command not found
error, and you are using OSX, run the following command:
brew install coreutils
Running make
again afterwards should work.
This project uses dep
to manage Go dependencies.
To make things easier for reviewers, put updates to vendor/
in a separate commit within the same PR.
To introduce a new dependency to the ksonnet codebase, follow these steps:
-
Open an issue to discuss the use case and need for the dependency with the project maintainers.
-
After building agreement, vendor the dependency using
dep
.- Where possible, please pin the dependency to a specific stable version. Please do not vendor HEAD if you can avoid it!
- Please introduce a vendored dependency in a dedicated commit to make review easier!
-
Write the code change that imports and uses the new dependency.
-
Run the following in the root of the ksonnet repository:
# Add new dependency dep ensure -add github.com/pkg/foo
-
Prune unused dependencies in `vendor```
# Prune dep prune
-
Separate your dependencies (i.e.
vendor/
,Gopkg.*
) and actual code changes into different pull requests:- Make a separate commit for your dependency changes, and cherry-pick it it into a new branch. Submit a PR for review.
- After your dependency changes are checked in, rebase your original code change and submit that PR.
-
Feel awesome for making a sizeable contribution to ksonnet! 🎉
Pinning a dependency avoids the issue of breaking updates.
# Pin all imported client-go packages to release >= 3.0.0, < 3.1.0
dep ensure -add k8s.io/client-go@~v3.0.0
Before making a PR, you should make sure to test your changes.
To do so, run make test
in the root of the ksonnet repo, specifying any additional, custom Go flags with $EXTRA_GO_FLAGS
.
See our release documentation for the process of creating a release.