|
| 1 | +## Contribute to Sysbox |
| 2 | + |
| 3 | +Want to contribute to Sysbox? Thanks, the Sysbox community welcomes your |
| 4 | +contributions! |
| 5 | + |
| 6 | +This page contains information about the process to contribute. |
| 7 | + |
| 8 | +### Reporting security issues |
| 9 | + |
| 10 | +Strong container security is of upmost concern for Sysbox. |
| 11 | + |
| 12 | +If you are reporting a security issue, please do not create an issue or file a |
| 13 | +pull request on GitHub. Instead, disclose the issue responsibly by sending an |
| 14 | + |
| 15 | + |
| 16 | +### Reporting other issues |
| 17 | + |
| 18 | +Please follow these guidelines when filing issues with Sysbox. |
| 19 | + |
| 20 | +In all cases, first search existing issues, as it's likely the bug has already |
| 21 | +been reported (and we want to avoid multiple bugs for the same issue). |
| 22 | + |
| 23 | +#### Bug Reports |
| 24 | + |
| 25 | +* Create a GitHub issue with the label "Bug" |
| 26 | + |
| 27 | +* Add a label corresponding to the Sysbox release (e.g. `v0.2.0`) |
| 28 | + |
| 29 | +* Describe the issue as clearly and completely as possible. |
| 30 | + |
| 31 | +* Describe how to best reproduce it. |
| 32 | + |
| 33 | +* Include information about the host's Linux version (e.g., `lsb_release`, `uname -a`). |
| 34 | + |
| 35 | +#### Feature requests |
| 36 | + |
| 37 | +* Create a GitHub issue with the label "Enhancement" |
| 38 | + |
| 39 | +* Add a label corresponding to the Sysbox release (e.g. `v0.2.0`) |
| 40 | + |
| 41 | +* Describe the need for the proposed enhancement. |
| 42 | + |
| 43 | +* Provide a high-level description of the enhancement and its benefits. |
| 44 | + |
| 45 | +#### Documentation Changes |
| 46 | + |
| 47 | +* Create a GitHub issue with the label "Documentation" |
| 48 | + |
| 49 | +* Describe the need for the proposed documentation change. |
| 50 | + |
| 51 | +### Developer's guide |
| 52 | + |
| 53 | +If you with to contribute code changes to Sysbox, the [developer's guide](docs/developers-guide.md) |
| 54 | +has all the info to help you setup your environment for building and testing |
| 55 | +Sysbox. |
| 56 | + |
| 57 | +### We welcome pull requests |
| 58 | + |
| 59 | +We appreciate your pull requests, as they help us improve Sysbox. |
| 60 | + |
| 61 | +A pull request can fix or improve any aspect of Sysbox, from a minor |
| 62 | +documentation typo to an important feature. |
| 63 | + |
| 64 | +For pull requests that fix bugs, add features / functionality, or change |
| 65 | +documentation in important ways, we ask that you first file an issue (see prior |
| 66 | +section), such that the pull request can be coupled to that issue. |
| 67 | + |
| 68 | +For minor changes (e.g., a small documentation typo, a small code refactoring, |
| 69 | +adding a small test, etc.), you can file the pull request without filing an |
| 70 | +issue for it. |
| 71 | + |
| 72 | +If your pull request is not accepted on the first try, don't be discouraged. The |
| 73 | +community will do its best to give you constructive feedback so you can improve |
| 74 | +the pull request. |
| 75 | + |
| 76 | +### Criteria for accepting changes |
| 77 | + |
| 78 | +The Sysbox maintainers are in charge of approving pull requests. |
| 79 | + |
| 80 | +They will do so based on: |
| 81 | + |
| 82 | +* The need for the change. |
| 83 | + |
| 84 | +* Whether the change meets the goals of Sysbox project's community. |
| 85 | + |
| 86 | +* The quality of the change. |
| 87 | + |
| 88 | +* The testing done (when appropriate). |
| 89 | + |
| 90 | +### Open-source vs. proprietary functionality |
| 91 | + |
| 92 | +To ensure synergy between the Sysbox project and companies that wish to build |
| 93 | +products based on it (such as Nestybox), we use the following criteria when |
| 94 | +considering adding functionality to Sysbox: |
| 95 | + |
| 96 | +Any features that mainly benefit individual practitioners are made part of the Sysbox |
| 97 | +open-source project. Any features that mainly address enterprise-level needs are |
| 98 | +not part of the Sysbox open-source project. |
| 99 | + |
| 100 | +The Sysbox maintainers will make this determination on a feature by feature |
| 101 | +basis, with total transparency. |
| 102 | + |
| 103 | +This way, the Sysbox open source project satisfies the needs of individual |
| 104 | +practitioners while giving companies such as Nestybox the chance to monetize on |
| 105 | +enterprise-level features (which in turn enables Nestybox to continue to sponsor |
| 106 | +the Sysbox open source project). |
| 107 | + |
| 108 | +### Write clean code |
| 109 | + |
| 110 | +Write clean code (keep it simple, make it easy to understand for your fellow |
| 111 | +contributors). |
| 112 | + |
| 113 | +Sysbox is written in [Go](https://golang.org/). Always run `gofmt -s -w file.go` |
| 114 | +on each changed file before committing your changes. Most editors have plugins |
| 115 | +that do this automatically. |
| 116 | + |
| 117 | +### Testing is super important |
| 118 | + |
| 119 | +All functional changes to Sysbox must pass the Sysbox's regression test suite |
| 120 | +before the pull request can be accepted. |
| 121 | + |
| 122 | +In addition, changes that fix bugs or add new functionality must be accompanied |
| 123 | +with a corresponding set of tests. |
| 124 | + |
| 125 | +In Sysbox, tests are divided into two categories: |
| 126 | + |
| 127 | +* Unit tests: written with Go's "testing" package. |
| 128 | + |
| 129 | +* Integration tests: written using the [bats](https://github.com/sstephenson/bats) framework. |
| 130 | + |
| 131 | +In general, having a combination of these is best, with unit tests performing |
| 132 | +thorough testing (main code paths, corner-cases, etc) and integration tests |
| 133 | +focusing on interaction of the target functionality with other aspects of Sysbox |
| 134 | +or the rest of the system. |
| 135 | + |
| 136 | +The [developer's guide](docs/developers-guide.md) has the info on how to run |
| 137 | +Sysbox tests. |
| 138 | + |
| 139 | +### Please keep the documentation up to date |
| 140 | + |
| 141 | +Sysbox is a complex piece of software. As such, clear and concise documentation |
| 142 | +describing its features and functionality is of upmost importance. |
| 143 | + |
| 144 | +Please update the docs whenever: |
| 145 | + |
| 146 | +* You see a mismatch between the document and existing functionality. |
| 147 | + |
| 148 | +* You add a new feature. |
| 149 | + |
| 150 | +* You change or remove an existing feature. |
| 151 | + |
| 152 | +* You spot typos, missing docs, or unclear/incorrect docs. |
| 153 | + |
| 154 | +### Process for creating pull requests |
| 155 | + |
| 156 | +1) Fork the Sysbox repo |
| 157 | + |
| 158 | +2) Make changes on your fork in a dedicated branch. |
| 159 | + |
| 160 | +- Name it XXX-something where XXX is the number of the issue (e.g., "202-fix"). |
| 161 | + |
| 162 | +3) Test your changes (see [above](#testing-is-super-important). |
| 163 | + |
| 164 | +4) Commit the changes in your branch |
| 165 | + |
| 166 | +- Commit messages must start with a capitalized and short summary (max. 70 |
| 167 | + chars) written in the imperative, followed by an optional, more detailed |
| 168 | + explanatory text which is separated from the summary by an empty line. |
| 169 | + |
| 170 | +- For example: |
| 171 | + |
| 172 | + "Add a command line option to configure logging in sysbox-mgr. |
| 173 | + |
| 174 | + Add the "--log-level" option to the sysbox-mgr, to configure |
| 175 | + logging levels. We initially support the following log-levels ..." |
| 176 | + |
| 177 | +- Sign-off the commit (see [next section](#sign-your-work)). |
| 178 | + |
| 179 | +5) Submit the pull request. |
| 180 | + |
| 181 | +- Pull requests descriptions should be as clear as possible and include a |
| 182 | + reference to all the issues that they address. |
| 183 | + |
| 184 | +- Pull requests must not contain commits from other users or branches. |
| 185 | + |
| 186 | +Code review comments may be added to your pull request. Discuss, then make the |
| 187 | +suggested modifications and push additional commits to your feature branch. Be |
| 188 | +sure to post a comment after pushing. The new commits will show up in the pull |
| 189 | +request automatically, but the reviewers will not be notified unless you |
| 190 | +comment. |
| 191 | + |
| 192 | +Before the pull request is merged, make sure that you squash your commits into |
| 193 | +logical units of work using `git rebase -i` and `git push -f`. After every |
| 194 | +commit the test suite should be passing. |
| 195 | + |
| 196 | +Include documentation changes in the same commit so that a revert would remove |
| 197 | +all traces of the feature or fix. |
| 198 | + |
| 199 | +TODO: Commits that fix or close an issue should include a reference like `Closes |
| 200 | +#XXX` or `Fixes #XXX`, which will automatically close the issue when merged. |
| 201 | + |
| 202 | +### Sign your work |
| 203 | + |
| 204 | +The sign-off is a simple line at the end of the explanation for the |
| 205 | +patch, which certifies that you wrote it or otherwise have the right to |
| 206 | +pass it on as an open-source patch. |
| 207 | + |
| 208 | +The rules are pretty simple: if you can certify the below (from |
| 209 | +[developercertificate.org](http://developercertificate.org/)): |
| 210 | + |
| 211 | +``` |
| 212 | +Developer Certificate of Origin |
| 213 | +Version 1.1 |
| 214 | +
|
| 215 | +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. |
| 216 | +660 York Street, Suite 102, |
| 217 | +San Francisco, CA 94110 USA |
| 218 | +
|
| 219 | +Everyone is permitted to copy and distribute verbatim copies of this |
| 220 | +license document, but changing it is not allowed. |
| 221 | +
|
| 222 | +
|
| 223 | +Developer's Certificate of Origin 1.1 |
| 224 | +
|
| 225 | +By making a contribution to this project, I certify that: |
| 226 | +
|
| 227 | +(a) The contribution was created in whole or in part by me and I |
| 228 | + have the right to submit it under the open source license |
| 229 | + indicated in the file; or |
| 230 | +
|
| 231 | +(b) The contribution is based upon previous work that, to the best |
| 232 | + of my knowledge, is covered under an appropriate open source |
| 233 | + license and I have the right under that license to submit that |
| 234 | + work with modifications, whether created in whole or in part |
| 235 | + by me, under the same open source license (unless I am |
| 236 | + permitted to submit under a different license), as indicated |
| 237 | + in the file; or |
| 238 | +
|
| 239 | +(c) The contribution was provided directly to me by some other |
| 240 | + person who certified (a), (b) or (c) and I have not modified |
| 241 | + it. |
| 242 | +
|
| 243 | +(d) I understand and agree that this project and the contribution |
| 244 | + are public and that a record of the contribution (including all |
| 245 | + personal information I submit with it, including my sign-off) is |
| 246 | + maintained indefinitely and may be redistributed consistent with |
| 247 | + this project or the open source license(s) involved. |
| 248 | +``` |
| 249 | + |
| 250 | +then you just add a line to every git commit message: |
| 251 | + |
| 252 | + Signed-off-by: Joe Smith <[email protected]> |
| 253 | + |
| 254 | +using your real name (sorry, no pseudonyms or anonymous contributions.) |
| 255 | + |
| 256 | +You can add the sign off when creating the git commit via `git commit -s`. |
0 commit comments