Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contributor guide #5426

Merged
merged 5 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 83 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[CNCF Code of Conduct]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
[Kubernetes Community Membership]: https://github.com/kubernetes/community/blob/master/community-membership.md

[Kustomize Architecture]: ARCHITECTURE.md
[Contribution Guide]: https://kubectl.docs.kubernetes.io/contributing/kustomize/
[MacOS Dev Guide]: https://kubectl.docs.kubernetes.io/contributing/kustomize/mac/
[Windows Dev Guide]: https://kubectl.docs.kubernetes.io/contributing/kustomize/windows/
Expand All @@ -25,13 +26,88 @@ _As contributors and maintainers of this project, and in the interest of fosteri

## Getting Started

Dev guides:

- [Contribution Guide]
- [MacOS Dev Guide]
- [Windows Dev Guide]

General resources for contributors:
### Forking Kustomize and Working Locally
The Kustomize project uses a "Fork and Pull" workflow that is standard to GitHub. In git terms, your personal fork is referred to as the "origin" and the actual project's git repository is called "upstream". To keep your personal branch (origin) up to date with the project (upstream), it must be configured within your local working copy.

### Create a fork in GitHub
1. Visit https://github.com/kubernetes-sigs/kustomize
2. Click the `Fork` button on the top right

### Clone the repository
```bash
# Clone your repository fork from the previous step
git clone --recurse-submodules git@github.com:<your github username>/kustomize.git
cd kustomize

# Configure upstream
git remote add upstream https://github.com/kubernetes-sigs/kustomize
Copy link
Contributor

@natasha41575 natasha41575 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuine question (you don't have to change anything if this is how you have yours set up, since it seems to be working great) - Does it make a difference if we use the ssh URL for the upstream vs the http one? I have my upstream configured with the ssh one, but I'm not sure if that actually affects anything in our workflows

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference I think I've observed is that

  • ssh: you need to authenticate for push and pull, but you can use 2 factor
  • http: you only need to authenticate for push, but you need to enter your password
    Given that we don't need to push to upstream, I think http is probably easier

git remote set-url --push upstream no_push

# Review git configuration
git remote -v
```

### Create a working branch
```bash
# Fetch changes from upstream master
cd kustomize
git fetch upstream
git checkout master
git rebase upstream/master

# Create your working branch
git checkout -b myfeature
```

### Sync your working branch
You will need to periodically fetch changes from the `upstream` repository to keep your working branch in sync.
```bash
cd kustomize
git fetch upstream
git checkout myfeature
git rebase upstream/master
```
ncapps marked this conversation as resolved.
Show resolved Hide resolved

### Push to GitHub
When your changes are ready for review, push your working branch to your fork on GitHub.
```bash
cd kustomize
git push origin myfeature
```

### Create a Pull Request
1. Visit your fork at `https://github.com/<user>/kustomize`
2. Click the **Compare & Pull Request** button next to your `myfeature` branch.
3. Check out the pull request [process](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md) for more details and advice.

ncapps marked this conversation as resolved.
Show resolved Hide resolved
If you ran `git push` in the previous step, GitHub will return a useful link to create a Pull Request.


### Build Kustomize
The [Kustomize Architecture] document describes the respository organization and the kustomize build process.
```bash
# For go version >= 1.13
unset GOPATH
unset GO111MODULES

# Build kustomize binary and install in go bin path
cd kustomize
make kustomize

# Run unit tests
make test-unit-all

# Run linter
make lint

# Test examples against HEAD
make test-examples-kustomize-against-HEAD

# Run your development version
~/go/bin/kustomize version
```

### General resources for contributors

- [Contributor License Agreement] - Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests.
- [Kubernetes Contributor Guide] - Main contributor documentation.
Expand Down
Loading