a6ebdb22be10b24fd4e54fae2e00751ddff6c7d6
[it/test.git] / XTesting / kubespray / CONTRIBUTING.md
1 # Contributing guidelines
2
3 ## How to become a contributor and submit your own code
4
5 ### Environment setup
6
7 It is recommended to use filter to manage the GitHub email notification, see [examples for setting filters to Kubernetes Github notifications](https://github.com/kubernetes/community/blob/master/communication/best-practices.md#examples-for-setting-filters-to-kubernetes-github-notifications)
8
9 To install development dependencies you can set up a python virtual env with the necessary dependencies:
10
11 ```ShellSession
12 virtualenv venv
13 source venv/bin/activate
14 pip install -r tests/requirements.txt
15 ```
16
17 #### Linting
18
19 Kubespray uses `yamllint` and `ansible-lint`. To run them locally use `yamllint .` and `ansible-lint`. It is a good idea to add call these tools as part of your pre-commit hook and avoid a lot of back end forth on fixing linting issues (<https://support.gitkraken.com/working-with-repositories/githooksexample/>).
20
21 #### Molecule
22
23 [molecule](https://github.com/ansible-community/molecule) is designed to help the development and testing of Ansible roles. In Kubespray you can run it all for all roles with `./tests/scripts/molecule_run.sh` or for a specific role (that you are working with) with `molecule test` from the role directory (`cd roles/my-role`).
24
25 When developing or debugging a role it can be useful to run `molecule create` and `molecule converge` separately. Then you can use `molecule login` to SSH into the test environment.
26
27 #### Vagrant
28
29 Vagrant with VirtualBox or libvirt driver helps you to quickly spin test clusters to test things end to end. See [README.md#vagrant](README.md)
30
31 ### Contributing A Patch
32
33 1. Submit an issue describing your proposed change to the repo in question.
34 2. The [repo owners](OWNERS) will respond to your issue promptly.
35 3. Fork the desired repo, develop and test your code changes.
36 4. Sign the CNCF CLA (<https://git.k8s.io/community/CLA.md#the-contributor-license-agreement>)
37 5. Submit a pull request.
38 6. Work with the reviewers on their suggestions.
39 7. Ensure to rebase to the HEAD of your target branch and squash un-necessary commits (<https://blog.carbonfive.com/always-squash-and-rebase-your-git-commits/>) before final merger of your contribution.