github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/CONTRIBUTING.md (about) 1 # Contribute to the Moby Project 2 3 Want to hack on the Moby Project? Awesome! We have a contributor's guide that explains 4 [setting up a development environment and the contribution 5 process](docs/contributing/). 6 7 [![Contributors guide](docs/static_files/contributors.png)](https://docs.docker.com/opensource/project/who-written-for/) 8 9 This page contains information about reporting issues as well as some tips and 10 guidelines useful to experienced open source contributors. Finally, make sure 11 you read our [community guidelines](#moby-community-guidelines) before you 12 start participating. 13 14 ## Topics 15 16 * [Reporting Security Issues](#reporting-security-issues) 17 * [Design and Cleanup Proposals](#design-and-cleanup-proposals) 18 * [Reporting Issues](#reporting-other-issues) 19 * [Quick Contribution Tips and Guidelines](#quick-contribution-tips-and-guidelines) 20 * [Community Guidelines](#moby-community-guidelines) 21 22 ## Reporting security issues 23 24 The Moby maintainers take security seriously. If you discover a security 25 issue, please bring it to their attention right away! 26 27 Please **DO NOT** file a public issue, instead send your report privately to 28 [security@docker.com](mailto:security@docker.com). 29 30 Security reports are greatly appreciated and we will publicly thank you for it. 31 We also like to send gifts—if you're into schwag, make sure to let 32 us know. We currently do not offer a paid security bounty program, but are not 33 ruling it out in the future. 34 35 36 ## Reporting other issues 37 38 A great way to contribute to the project is to send a detailed report when you 39 encounter an issue. We always appreciate a well-written, thorough bug report, 40 and will thank you for it! 41 42 Check that [our issue database](https://github.com/moby/moby/issues) 43 doesn't already include that problem or suggestion before submitting an issue. 44 If you find a match, you can use the "subscribe" button to get notified on 45 updates. Do *not* leave random "+1" or "I have this too" comments, as they 46 only clutter the discussion, and don't help resolving it. However, if you 47 have ways to reproduce the issue or have additional information that may help 48 resolving the issue, please leave a comment. 49 50 When reporting issues, always include: 51 52 * The output of `docker version`. 53 * The output of `docker info`. 54 55 Also include the steps required to reproduce the problem if possible and 56 applicable. This information will help us review and fix your issue faster. 57 When sending lengthy log-files, consider posting them as a gist (https://gist.github.com). 58 Don't forget to remove sensitive data from your logfiles before posting (you can 59 replace those parts with "REDACTED"). 60 61 ## Quick contribution tips and guidelines 62 63 This section gives the experienced contributor some tips and guidelines. 64 65 ### Pull requests are always welcome 66 67 Not sure if that typo is worth a pull request? Found a bug and know how to fix 68 it? Do it! We will appreciate it. Any significant improvement should be 69 documented as [a GitHub issue](https://github.com/moby/moby/issues) before 70 anybody starts working on it. 71 72 We are always thrilled to receive pull requests. We do our best to process them 73 quickly. If your pull request is not accepted on the first try, 74 don't get discouraged! Our contributor's guide explains [the review process we 75 use for simple changes](https://docs.docker.com/opensource/workflow/make-a-contribution/). 76 77 ### Design and cleanup proposals 78 79 You can propose new designs for existing Docker features. You can also design 80 entirely new features. We really appreciate contributors who want to refactor or 81 otherwise cleanup our project. For information on making these types of 82 contributions, see [the advanced contribution 83 section](https://docs.docker.com/opensource/workflow/advanced-contributing/) in 84 the contributors guide. 85 86 ### Connect with other Moby Project contributors 87 88 <table class="tg"> 89 <col width="45%"> 90 <col width="65%"> 91 <tr> 92 <td>Forums</td> 93 <td> 94 A public forum for users to discuss questions and explore current design patterns and 95 best practices about all the Moby projects. To participate, log in with your Github 96 account or create an account at <a href="https://forums.mobyproject.org" target="_blank">https://forums.mobyproject.org</a>. 97 </td> 98 </tr> 99 <tr> 100 <td>Slack</td> 101 <td> 102 <p> 103 Register for the Docker Community Slack at 104 <a href="https://community.docker.com/registrations/groups/4316" target="_blank">https://community.docker.com/registrations/groups/4316</a>. 105 We use the #moby-project channel for general discussion, and there are separate channels for other Moby projects such as #containerd. 106 Archives are available at <a href="https://dockercommunity.slackarchive.io/" target="_blank">https://dockercommunity.slackarchive.io/</a>. 107 </p> 108 </td> 109 </tr> 110 <tr> 111 <td>Twitter</td> 112 <td> 113 You can follow <a href="https://twitter.com/moby/" target="_blank">Moby Project Twitter feed</a> 114 to get updates on our products. You can also tweet us questions or just 115 share blogs or stories. 116 </td> 117 </tr> 118 </table> 119 120 121 ### Conventions 122 123 Fork the repository and make changes on your fork in a feature branch: 124 125 - If it's a bug fix branch, name it XXXX-something where XXXX is the number of 126 the issue. 127 - If it's a feature branch, create an enhancement issue to announce 128 your intentions, and name it XXXX-something where XXXX is the number of the 129 issue. 130 131 Submit tests for your changes. See [TESTING.md](./TESTING.md) for details. 132 133 If your changes need integration tests, write them against the API. The `cli` 134 integration tests are slowly either migrated to API tests or moved away as unit 135 tests in `docker/cli` and end-to-end tests for Docker. 136 137 Update the documentation when creating or modifying features. Test your 138 documentation changes for clarity, concision, and correctness, as well as a 139 clean documentation build. See our contributors guide for [our style 140 guide](https://docs.docker.com/opensource/doc-style) and instructions on [building 141 the documentation](https://docs.docker.com/opensource/project/test-and-docs/#build-and-test-the-documentation). 142 143 Write clean code. Universally formatted code promotes ease of writing, reading, 144 and maintenance. Always run `gofmt -s -w file.go` on each changed file before 145 committing your changes. Most editors have plug-ins that do this automatically. 146 147 Pull request descriptions should be as clear as possible and include a reference 148 to all the issues that they address. 149 150 ### Successful Changes 151 152 Before contributing large or high impact changes, make the effort to coordinate 153 with the maintainers of the project before submitting a pull request. This 154 prevents you from doing extra work that may or may not be merged. 155 156 Large PRs that are just submitted without any prior communication are unlikely 157 to be successful. 158 159 While pull requests are the methodology for submitting changes to code, changes 160 are much more likely to be accepted if they are accompanied by additional 161 engineering work. While we don't define this explicitly, most of these goals 162 are accomplished through communication of the design goals and subsequent 163 solutions. Often times, it helps to first state the problem before presenting 164 solutions. 165 166 Typically, the best methods of accomplishing this are to submit an issue, 167 stating the problem. This issue can include a problem statement and a 168 checklist with requirements. If solutions are proposed, alternatives should be 169 listed and eliminated. Even if the criteria for elimination of a solution is 170 frivolous, say so. 171 172 Larger changes typically work best with design documents. These are focused on 173 providing context to the design at the time the feature was conceived and can 174 inform future documentation contributions. 175 176 ### Commit Messages 177 178 Commit messages must start with a capitalized and short summary (max. 50 chars) 179 written in the imperative, followed by an optional, more detailed explanatory 180 text which is separated from the summary by an empty line. 181 182 Commit messages should follow best practices, including explaining the context 183 of the problem and how it was solved, including in caveats or follow up changes 184 required. They should tell the story of the change and provide readers 185 understanding of what led to it. 186 187 If you're lost about what this even means, please see [How to Write a Git 188 Commit Message](http://chris.beams.io/posts/git-commit/) for a start. 189 190 In practice, the best approach to maintaining a nice commit message is to 191 leverage a `git add -p` and `git commit --amend` to formulate a solid 192 changeset. This allows one to piece together a change, as information becomes 193 available. 194 195 If you squash a series of commits, don't just submit that. Re-write the commit 196 message, as if the series of commits was a single stroke of brilliance. 197 198 That said, there is no requirement to have a single commit for a PR, as long as 199 each commit tells the story. For example, if there is a feature that requires a 200 package, it might make sense to have the package in a separate commit then have 201 a subsequent commit that uses it. 202 203 Remember, you're telling part of the story with the commit message. Don't make 204 your chapter weird. 205 206 ### Review 207 208 Code review comments may be added to your pull request. Discuss, then make the 209 suggested modifications and push additional commits to your feature branch. Post 210 a comment after pushing. New commits show up in the pull request automatically, 211 but the reviewers are notified only when you comment. 212 213 Pull requests must be cleanly rebased on top of master without multiple branches 214 mixed into the PR. 215 216 **Git tip**: If your PR no longer merges cleanly, use `rebase master` in your 217 feature branch to update your pull request rather than `merge master`. 218 219 Before you make a pull request, squash your commits into logical units of work 220 using `git rebase -i` and `git push -f`. A logical unit of work is a consistent 221 set of patches that should be reviewed together: for example, upgrading the 222 version of a vendored dependency and taking advantage of its now available new 223 feature constitute two separate units of work. Implementing a new function and 224 calling it in another file constitute a single logical unit of work. The very 225 high majority of submissions should have a single commit, so if in doubt: squash 226 down to one. 227 228 After every commit, [make sure the test suite passes](./TESTING.md). Include 229 documentation changes in the same pull request so that a revert would remove 230 all traces of the feature or fix. 231 232 Include an issue reference like `Closes #XXXX` or `Fixes #XXXX` in commits that 233 close an issue. Including references automatically closes the issue on a merge. 234 235 Please do not add yourself to the `AUTHORS` file, as it is regenerated regularly 236 from the Git history. 237 238 Please see the [Coding Style](#coding-style) for further guidelines. 239 240 ### Merge approval 241 242 Moby maintainers use LGTM (Looks Good To Me) in comments on the code review to 243 indicate acceptance, or use the Github review approval feature. 244 245 For an explanation of the review and approval process see the 246 [REVIEWING](project/REVIEWING.md) page. 247 248 ### Sign your work 249 250 The sign-off is a simple line at the end of the explanation for the patch. Your 251 signature certifies that you wrote the patch or otherwise have the right to pass 252 it on as an open-source patch. The rules are pretty simple: if you can certify 253 the below (from [developercertificate.org](http://developercertificate.org/)): 254 255 ``` 256 Developer Certificate of Origin 257 Version 1.1 258 259 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 260 1 Letterman Drive 261 Suite D4700 262 San Francisco, CA, 94129 263 264 Everyone is permitted to copy and distribute verbatim copies of this 265 license document, but changing it is not allowed. 266 267 Developer's Certificate of Origin 1.1 268 269 By making a contribution to this project, I certify that: 270 271 (a) The contribution was created in whole or in part by me and I 272 have the right to submit it under the open source license 273 indicated in the file; or 274 275 (b) The contribution is based upon previous work that, to the best 276 of my knowledge, is covered under an appropriate open source 277 license and I have the right under that license to submit that 278 work with modifications, whether created in whole or in part 279 by me, under the same open source license (unless I am 280 permitted to submit under a different license), as indicated 281 in the file; or 282 283 (c) The contribution was provided directly to me by some other 284 person who certified (a), (b) or (c) and I have not modified 285 it. 286 287 (d) I understand and agree that this project and the contribution 288 are public and that a record of the contribution (including all 289 personal information I submit with it, including my sign-off) is 290 maintained indefinitely and may be redistributed consistent with 291 this project or the open source license(s) involved. 292 ``` 293 294 Then you just add a line to every git commit message: 295 296 Signed-off-by: Joe Smith <joe.smith@email.com> 297 298 Use your real name (sorry, no pseudonyms or anonymous contributions.) 299 300 If you set your `user.name` and `user.email` git configs, you can sign your 301 commit automatically with `git commit -s`. 302 303 ### How can I become a maintainer? 304 305 The procedures for adding new maintainers are explained in the 306 [/project/GOVERNANCE.md](/project/GOVERNANCE.md) 307 file in this repository. 308 309 Don't forget: being a maintainer is a time investment. Make sure you 310 will have time to make yourself available. You don't have to be a 311 maintainer to make a difference on the project! 312 313 ### Manage issues and pull requests using the Derek bot 314 315 If you want to help label, assign, close or reopen issues or pull requests 316 without commit rights, ask a maintainer to add your Github handle to the 317 `.DEREK.yml` file. [Derek](https://github.com/alexellis/derek) is a bot that extends 318 Github's user permissions to help non-committers to manage issues and pull requests simply by commenting. 319 320 For example: 321 322 * Labels 323 324 ``` 325 Derek add label: kind/question 326 Derek remove label: status/claimed 327 ``` 328 329 * Assign work 330 331 ``` 332 Derek assign: username 333 Derek unassign: me 334 ``` 335 336 * Manage issues and PRs 337 338 ``` 339 Derek close 340 Derek reopen 341 ``` 342 343 ## Moby community guidelines 344 345 We want to keep the Moby community awesome, growing and collaborative. We need 346 your help to keep it that way. To help with this we've come up with some general 347 guidelines for the community as a whole: 348 349 * Be nice: Be courteous, respectful and polite to fellow community members: 350 no regional, racial, gender, or other abuse will be tolerated. We like 351 nice people way better than mean ones! 352 353 * Encourage diversity and participation: Make everyone in our community feel 354 welcome, regardless of their background and the extent of their 355 contributions, and do everything possible to encourage participation in 356 our community. 357 358 * Keep it legal: Basically, don't get us in trouble. Share only content that 359 you own, do not share private or sensitive information, and don't break 360 the law. 361 362 * Stay on topic: Make sure that you are posting to the correct channel and 363 avoid off-topic discussions. Remember when you update an issue or respond 364 to an email you are potentially sending to a large number of people. Please 365 consider this before you update. Also remember that nobody likes spam. 366 367 * Don't send email to the maintainers: There's no need to send email to the 368 maintainers to ask them to investigate an issue or to take a look at a 369 pull request. Instead of sending an email, GitHub mentions should be 370 used to ping maintainers to review a pull request, a proposal or an 371 issue. 372 373 The open source governance for this repository is handled via the [Moby Technical Steering Committee (TSC)](https://github.com/moby/tsc) 374 charter. For any concerns with the community process regarding technical contributions, 375 please contact the TSC. More information on project governance is available in 376 our [project/GOVERNANCE.md](/project/GOVERNANCE.md) document. 377 378 ### Guideline violations — 3 strikes method 379 380 The point of this section is not to find opportunities to punish people, but we 381 do need a fair way to deal with people who are making our community suck. 382 383 1. First occurrence: We'll give you a friendly, but public reminder that the 384 behavior is inappropriate according to our guidelines. 385 386 2. Second occurrence: We will send you a private message with a warning that 387 any additional violations will result in removal from the community. 388 389 3. Third occurrence: Depending on the violation, we may need to delete or ban 390 your account. 391 392 **Notes:** 393 394 * Obvious spammers are banned on first occurrence. If we don't do this, we'll 395 have spam all over the place. 396 397 * Violations are forgiven after 6 months of good behavior, and we won't hold a 398 grudge. 399 400 * People who commit minor infractions will get some education, rather than 401 hammering them in the 3 strikes process. 402 403 * The rules apply equally to everyone in the community, no matter how much 404 you've contributed. 405 406 * Extreme violations of a threatening, abusive, destructive or illegal nature 407 will be addressed immediately and are not subject to 3 strikes or forgiveness. 408 409 * Contact abuse@docker.com to report abuse or appeal violations. In the case of 410 appeals, we know that mistakes happen, and we'll work with you to come up with a 411 fair solution if there has been a misunderstanding. 412 413 ## Coding Style 414 415 Unless explicitly stated, we follow all coding guidelines from the Go 416 community. While some of these standards may seem arbitrary, they somehow seem 417 to result in a solid, consistent codebase. 418 419 It is possible that the code base does not currently comply with these 420 guidelines. We are not looking for a massive PR that fixes this, since that 421 goes against the spirit of the guidelines. All new contributions should make a 422 best effort to clean up and make the code base better than they left it. 423 Obviously, apply your best judgement. Remember, the goal here is to make the 424 code base easier for humans to navigate and understand. Always keep that in 425 mind when nudging others to comply. 426 427 The rules: 428 429 1. All code should be formatted with `gofmt -s`. 430 2. All code should pass the default levels of 431 [`golint`](https://github.com/golang/lint). 432 3. All code should follow the guidelines covered in [Effective 433 Go](http://golang.org/doc/effective_go.html) and [Go Code Review 434 Comments](https://github.com/golang/go/wiki/CodeReviewComments). 435 4. Comment the code. Tell us the why, the history and the context. 436 5. Document _all_ declarations and methods, even private ones. Declare 437 expectations, caveats and anything else that may be important. If a type 438 gets exported, having the comments already there will ensure it's ready. 439 6. Variable name length should be proportional to its context and no longer. 440 `noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`. 441 In practice, short methods will have short variable names and globals will 442 have longer names. 443 7. No underscores in package names. If you need a compound name, step back, 444 and re-examine why you need a compound name. If you still think you need a 445 compound name, lose the underscore. 446 8. No utils or helpers packages. If a function is not general enough to 447 warrant its own package, it has not been written generally enough to be a 448 part of a util package. Just leave it unexported and well-documented. 449 9. All tests should run with `go test` and outside tooling should not be 450 required. No, we don't need another unit testing framework. Assertion 451 packages are acceptable if they provide _real_ incremental value. 452 10. Even though we call these "rules" above, they are actually just 453 guidelines. Since you've read all the rules, you now know that. 454 455 If you are having trouble getting into the mood of idiomatic Go, we recommend 456 reading through [Effective Go](https://golang.org/doc/effective_go.html). The 457 [Go Blog](https://blog.golang.org) is also a great resource. Drinking the 458 kool-aid is a lot easier than going thirsty.