github.com/portworx/docker@v1.12.1/CONTRIBUTING.md (about)

     1  # Contributing to Docker
     2  
     3  Want to hack on Docker? Awesome!  We have a contributor's guide that explains
     4  [setting up a Docker development environment and the contribution
     5  process](https://docs.docker.com/opensource/project/who-written-for/). 
     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](#docker-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](#docker-community-guidelines)
    21  
    22  ## Reporting security issues
    23  
    24  The Docker 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 Docker 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/docker/docker/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/docker/docker/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  We try hard to keep Docker lean and focused. Docker can't do everything for
    87  everybody. This means that we might decide against incorporating a new feature.
    88  However, there might be a way to implement that feature *on top of* Docker.
    89  
    90  ### Talking to other Docker users and contributors
    91  
    92  <table class="tg">
    93    <col width="45%">
    94    <col width="65%">
    95    <tr>
    96      <td>Forums</td>
    97      <td>
    98        A public forum for users to discuss questions and explore current design patterns and
    99        best practices about Docker and related projects in the Docker Ecosystem. To participate,
   100        just log in with your Docker Hub account on <a href="https://forums.docker.com" target="_blank">https://forums.docker.com</a>.
   101      </td>
   102    </tr>
   103    <tr>
   104      <td>Internet&nbsp;Relay&nbsp;Chat&nbsp;(IRC)</td>
   105      <td>
   106        <p>
   107          IRC a direct line to our most knowledgeable Docker users; we have
   108          both the  <code>#docker</code> and <code>#docker-dev</code> group on
   109          <strong>irc.freenode.net</strong>.
   110          IRC is a rich chat protocol but it can overwhelm new users. You can search
   111          <a href="https://botbot.me/freenode/docker/#" target="_blank">our chat archives</a>.
   112        </p>
   113        <p>
   114          Read our <a href="https://docs.docker.com/opensource/get-help/#irc-quickstart" target="_blank">IRC quickstart guide</a>
   115          for an easy way to get started.
   116        </p>
   117      </td>
   118    </tr>
   119    <tr>
   120      <td>Google Group</td>
   121      <td>
   122        The <a href="https://groups.google.com/forum/#!forum/docker-dev" target="_blank">docker-dev</a>
   123        group is for contributors and other people contributing to the Docker project.
   124        You can join them without a google account by sending an email to 
   125        <a href="mailto:docker-dev+subscribe@googlegroups.com">docker-dev+subscribe@googlegroups.com</a>.
   126        After receiving the join-request message, you can simply reply to that to confirm the subscribtion.
   127      </td>
   128    </tr>
   129    <tr>
   130      <td>Twitter</td>
   131      <td>
   132        You can follow <a href="https://twitter.com/docker/" target="_blank">Docker's Twitter feed</a>
   133        to get updates on our products. You can also tweet us questions or just
   134        share blogs or stories.
   135      </td>
   136    </tr>
   137    <tr>
   138      <td>Stack Overflow</td>
   139      <td>
   140        Stack Overflow has over 17000 Docker questions listed. We regularly
   141        monitor <a href="https://stackoverflow.com/search?tab=newest&q=docker" target="_blank">Docker questions</a>
   142        and so do many other knowledgeable Docker users.
   143      </td>
   144    </tr>
   145  </table>
   146  
   147  
   148  ### Conventions
   149  
   150  Fork the repository and make changes on your fork in a feature branch:
   151  
   152  - If it's a bug fix branch, name it XXXX-something where XXXX is the number of
   153  	the issue. 
   154  - If it's a feature branch, create an enhancement issue to announce
   155  	your intentions, and name it XXXX-something where XXXX is the number of the
   156  	issue.
   157  
   158  Submit unit tests for your changes. Go has a great test framework built in; use
   159  it! Take a look at existing tests for inspiration. [Run the full test
   160  suite](https://docs.docker.com/opensource/project/test-and-docs/) on your branch before
   161  submitting a pull request.
   162  
   163  Update the documentation when creating or modifying features. Test your
   164  documentation changes for clarity, concision, and correctness, as well as a
   165  clean documentation build. See our contributors guide for [our style
   166  guide](https://docs.docker.com/opensource/doc-style) and instructions on [building
   167  the documentation](https://docs.docker.com/opensource/project/test-and-docs/#build-and-test-the-documentation).
   168  
   169  Write clean code. Universally formatted code promotes ease of writing, reading,
   170  and maintenance. Always run `gofmt -s -w file.go` on each changed file before
   171  committing your changes. Most editors have plug-ins that do this automatically.
   172  
   173  Pull request descriptions should be as clear as possible and include a reference
   174  to all the issues that they address.
   175  
   176  Commit messages must start with a capitalized and short summary (max. 50 chars)
   177  written in the imperative, followed by an optional, more detailed explanatory
   178  text which is separated from the summary by an empty line.
   179  
   180  Code review comments may be added to your pull request. Discuss, then make the
   181  suggested modifications and push additional commits to your feature branch. Post
   182  a comment after pushing. New commits show up in the pull request automatically,
   183  but the reviewers are notified only when you comment.
   184  
   185  Pull requests must be cleanly rebased on top of master without multiple branches
   186  mixed into the PR.
   187  
   188  **Git tip**: If your PR no longer merges cleanly, use `rebase master` in your
   189  feature branch to update your pull request rather than `merge master`.
   190  
   191  Before you make a pull request, squash your commits into logical units of work
   192  using `git rebase -i` and `git push -f`. A logical unit of work is a consistent
   193  set of patches that should be reviewed together: for example, upgrading the
   194  version of a vendored dependency and taking advantage of its now available new
   195  feature constitute two separate units of work. Implementing a new function and
   196  calling it in another file constitute a single logical unit of work. The very
   197  high majority of submissions should have a single commit, so if in doubt: squash
   198  down to one.
   199  
   200  After every commit, [make sure the test suite passes]
   201  (https://docs.docker.com/opensource/project/test-and-docs/). Include documentation
   202  changes in the same pull request so that a revert would remove all traces of
   203  the feature or fix.
   204  
   205  Include an issue reference like `Closes #XXXX` or `Fixes #XXXX` in commits that
   206  close an issue. Including references automatically closes the issue on a merge.
   207  
   208  Please do not add yourself to the `AUTHORS` file, as it is regenerated regularly
   209  from the Git history.
   210  
   211  Please see the [Coding Style](#coding-style) for further guidelines.
   212  
   213  ### Merge approval
   214  
   215  Docker maintainers use LGTM (Looks Good To Me) in comments on the code review to
   216  indicate acceptance.
   217  
   218  A change requires LGTMs from an absolute majority of the maintainers of each
   219  component affected. For example, if a change affects `docs/` and `registry/`, it
   220  needs an absolute majority from the maintainers of `docs/` AND, separately, an
   221  absolute majority of the maintainers of `registry/`.
   222  
   223  For more details, see the [MAINTAINERS](MAINTAINERS) page.
   224  
   225  ### Sign your work
   226  
   227  The sign-off is a simple line at the end of the explanation for the patch. Your
   228  signature certifies that you wrote the patch or otherwise have the right to pass
   229  it on as an open-source patch. The rules are pretty simple: if you can certify
   230  the below (from [developercertificate.org](http://developercertificate.org/)):
   231  
   232  ```
   233  Developer Certificate of Origin
   234  Version 1.1
   235  
   236  Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
   237  660 York Street, Suite 102,
   238  San Francisco, CA 94110 USA
   239  
   240  Everyone is permitted to copy and distribute verbatim copies of this
   241  license document, but changing it is not allowed.
   242  
   243  Developer's Certificate of Origin 1.1
   244  
   245  By making a contribution to this project, I certify that:
   246  
   247  (a) The contribution was created in whole or in part by me and I
   248      have the right to submit it under the open source license
   249      indicated in the file; or
   250  
   251  (b) The contribution is based upon previous work that, to the best
   252      of my knowledge, is covered under an appropriate open source
   253      license and I have the right under that license to submit that
   254      work with modifications, whether created in whole or in part
   255      by me, under the same open source license (unless I am
   256      permitted to submit under a different license), as indicated
   257      in the file; or
   258  
   259  (c) The contribution was provided directly to me by some other
   260      person who certified (a), (b) or (c) and I have not modified
   261      it.
   262  
   263  (d) I understand and agree that this project and the contribution
   264      are public and that a record of the contribution (including all
   265      personal information I submit with it, including my sign-off) is
   266      maintained indefinitely and may be redistributed consistent with
   267      this project or the open source license(s) involved.
   268  ```
   269  
   270  Then you just add a line to every git commit message:
   271  
   272      Signed-off-by: Joe Smith <joe.smith@email.com>
   273  
   274  Use your real name (sorry, no pseudonyms or anonymous contributions.)
   275  
   276  If you set your `user.name` and `user.email` git configs, you can sign your
   277  commit automatically with `git commit -s`.
   278  
   279  ### How can I become a maintainer?
   280  
   281  The procedures for adding new maintainers are explained in the 
   282  global [MAINTAINERS](https://github.com/docker/opensource/blob/master/MAINTAINERS)
   283  file in the [https://github.com/docker/opensource/](https://github.com/docker/opensource/)
   284  repository.
   285  
   286  Don't forget: being a maintainer is a time investment. Make sure you
   287  will have time to make yourself available. You don't have to be a
   288  maintainer to make a difference on the project!
   289  
   290  ## Docker community guidelines
   291  
   292  We want to keep the Docker community awesome, growing and collaborative. We need
   293  your help to keep it that way. To help with this we've come up with some general
   294  guidelines for the community as a whole:
   295  
   296  * Be nice: Be courteous, respectful and polite to fellow community members:
   297    no regional, racial, gender, or other abuse will be tolerated. We like
   298    nice people way better than mean ones!
   299  
   300  * Encourage diversity and participation: Make everyone in our community feel
   301    welcome, regardless of their background and the extent of their
   302    contributions, and do everything possible to encourage participation in
   303    our community.
   304  
   305  * Keep it legal: Basically, don't get us in trouble. Share only content that
   306    you own, do not share private or sensitive information, and don't break
   307    the law.
   308  
   309  * Stay on topic: Make sure that you are posting to the correct channel and
   310    avoid off-topic discussions. Remember when you update an issue or respond
   311    to an email you are potentially sending to a large number of people. Please
   312    consider this before you update. Also remember that nobody likes spam.
   313  
   314  * Don't send email to the maintainers: There's no need to send email to the
   315    maintainers to ask them to investigate an issue or to take a look at a
   316    pull request. Instead of sending an email, GitHub mentions should be
   317    used to ping maintainers to review a pull request, a proposal or an
   318    issue.
   319  
   320  ### Guideline violations — 3 strikes method
   321  
   322  The point of this section is not to find opportunities to punish people, but we
   323  do need a fair way to deal with people who are making our community suck.
   324  
   325  1. First occurrence: We'll give you a friendly, but public reminder that the
   326     behavior is inappropriate according to our guidelines.
   327  
   328  2. Second occurrence: We will send you a private message with a warning that
   329     any additional violations will result in removal from the community.
   330  
   331  3. Third occurrence: Depending on the violation, we may need to delete or ban
   332     your account.
   333  
   334  **Notes:**
   335  
   336  * Obvious spammers are banned on first occurrence. If we don't do this, we'll
   337    have spam all over the place.
   338  
   339  * Violations are forgiven after 6 months of good behavior, and we won't hold a
   340    grudge.
   341  
   342  * People who commit minor infractions will get some education, rather than
   343    hammering them in the 3 strikes process.
   344  
   345  * The rules apply equally to everyone in the community, no matter how much
   346  	you've contributed.
   347  
   348  * Extreme violations of a threatening, abusive, destructive or illegal nature
   349  	will be addressed immediately and are not subject to 3 strikes or forgiveness.
   350  
   351  * Contact abuse@docker.com to report abuse or appeal violations. In the case of
   352  	appeals, we know that mistakes happen, and we'll work with you to come up with a
   353  	fair solution if there has been a misunderstanding.
   354  
   355  ## Coding Style
   356  
   357  Unless explicitly stated, we follow all coding guidelines from the Go
   358  community. While some of these standards may seem arbitrary, they somehow seem
   359  to result in a solid, consistent codebase.
   360  
   361  It is possible that the code base does not currently comply with these
   362  guidelines. We are not looking for a massive PR that fixes this, since that
   363  goes against the spirit of the guidelines. All new contributions should make a
   364  best effort to clean up and make the code base better than they left it.
   365  Obviously, apply your best judgement. Remember, the goal here is to make the
   366  code base easier for humans to navigate and understand. Always keep that in
   367  mind when nudging others to comply.
   368  
   369  The rules:
   370  
   371  1. All code should be formatted with `gofmt -s`.
   372  2. All code should pass the default levels of
   373     [`golint`](https://github.com/golang/lint).
   374  3. All code should follow the guidelines covered in [Effective
   375     Go](http://golang.org/doc/effective_go.html) and [Go Code Review
   376     Comments](https://github.com/golang/go/wiki/CodeReviewComments).
   377  4. Comment the code. Tell us the why, the history and the context.
   378  5. Document _all_ declarations and methods, even private ones. Declare
   379     expectations, caveats and anything else that may be important. If a type
   380     gets exported, having the comments already there will ensure it's ready.
   381  6. Variable name length should be proportional to its context and no longer.
   382     `noCommaALongVariableNameLikeThisIsNotMoreClearWhenASimpleCommentWouldDo`.
   383     In practice, short methods will have short variable names and globals will
   384     have longer names.
   385  7. No underscores in package names. If you need a compound name, step back,
   386     and re-examine why you need a compound name. If you still think you need a
   387     compound name, lose the underscore.
   388  8. No utils or helpers packages. If a function is not general enough to
   389     warrant its own package, it has not been written generally enough to be a
   390     part of a util package. Just leave it unexported and well-documented.
   391  9. All tests should run with `go test` and outside tooling should not be
   392     required. No, we don't need another unit testing framework. Assertion
   393     packages are acceptable if they provide _real_ incremental value.
   394  10. Even though we call these "rules" above, they are actually just
   395      guidelines. Since you've read all the rules, you now know that.
   396  
   397  If you are having trouble getting into the mood of idiomatic Go, we recommend
   398  reading through [Effective Go](https://golang.org/doc/effective_go.html). The
   399  [Go Blog](https://blog.golang.org) is also a great resource. Drinking the
   400  kool-aid is a lot easier than going thirsty.