|
| 1 | +# Contributing |
| 2 | + |
| 3 | +By participating to this project, you agree to abide our [code of |
| 4 | +conduct](/CODE_OF_CONDUCT.md). |
| 5 | + |
| 6 | +## Setup your environment |
| 7 | + |
| 8 | +`devopsays-cli` is written in [Go](https://golang.org/). |
| 9 | + |
| 10 | +Prerequisites: |
| 11 | + |
| 12 | +* `make` |
| 13 | +* [Go 1.8+](https://golang.org/doc/install) |
| 14 | + |
| 15 | +Clone `devopsdays-cli` from source into `$GOPATH`: |
| 16 | + |
| 17 | +```sh |
| 18 | +$ mkdir -p $GOPATH/src/github.com/devopsdays/devopsdays-cli |
| 19 | +$ cd $_ |
| 20 | +$ git clone [email protected]:devopsdays/devopsdays-cli.git . |
| 21 | +``` |
| 22 | + |
| 23 | +Install the build and lint dependencies: |
| 24 | + |
| 25 | +```console |
| 26 | +$ make setup |
| 27 | +``` |
| 28 | + |
| 29 | +Before starting your own work, ensure the setup is good by running the test suite: |
| 30 | + |
| 31 | +```console |
| 32 | +$ make test |
| 33 | +``` |
| 34 | + |
| 35 | +### Git remote setup |
| 36 | + |
| 37 | +Change our remote to be named `upstream`: |
| 38 | + |
| 39 | +```sh |
| 40 | +$ git remote rename origin upstream |
| 41 | +``` |
| 42 | + |
| 43 | +Add your fork as `origin`: |
| 44 | + |
| 45 | +```sh |
| 46 | +$ git remote add fork [email protected]:you/devopsdays-cli.git |
| 47 | +``` |
| 48 | + |
| 49 | +## Making changes |
| 50 | + |
| 51 | +### Testing changes |
| 52 | + |
| 53 | +If you feel like you have things going well, please run the full tests: |
| 54 | + |
| 55 | +```sh |
| 56 | +$ make ci |
| 57 | +``` |
| 58 | + |
| 59 | +##3 Create a commit |
| 60 | + |
| 61 | +Commit messages should be well formatted. |
| 62 | +Start your commit message with a title in the imperative, i.e., "Updates function foo" vs "Updated function foo". Capitalize it. |
| 63 | + |
| 64 | +The title must be followed with a newline, then a more detailed description. |
| 65 | + |
| 66 | +Please reference any GitHub issues on the last line of the commit message (e.g. `See #123`, `Closes #123`, `Fixes #123`). |
| 67 | + |
| 68 | +An example: |
| 69 | + |
| 70 | +``` |
| 71 | +Add example for --debug flag |
| 72 | +
|
| 73 | +I added an example to the docs of the `--debug` flag to make |
| 74 | +the usage more clear. |
| 75 | +
|
| 76 | +Fixes #284 |
| 77 | +``` |
| 78 | + |
| 79 | +### Branching and Pull Requests |
| 80 | + |
| 81 | +(inspired by [Katrina Owen](kytrinyx)'s [excellent blog post](https://splice.com/blog/contributing-open-source-git-repositories-go/)) |
| 82 | + |
| 83 | +Assuming that the `you/devopsdays-cli` repo is at `origin`, and `devopsdays/devopsdays-cli` is at `upstream`, here's how to create a pull request: |
| 84 | + |
| 85 | +```sh |
| 86 | + |
| 87 | +$ git checkout -b make-thing-awesome |
| 88 | +$ git commit -a myfile.go |
| 89 | +$ git commit -s -m "Make thing more awesome" |
| 90 | +$ git push origin make-thing-awesome |
| 91 | + |
| 92 | +``` |
| 93 | + |
| 94 | +Don't forget to keep up to date with `upstream`: |
| 95 | + |
| 96 | +```sh |
| 97 | +$ git fetch upstream |
| 98 | +$ git reset --hard upstream/master |
| 99 | +``` |
| 100 | + |
| 101 | +## Developer Certification of Origin (DCO) |
| 102 | + |
| 103 | +Licensing is very important to open source projects. It helps ensure the software continues to be available under the terms that the author desired. |
| 104 | + |
| 105 | +This project uses [the MIT license](https://github.com/devopsdays/devopsdays-cli/blob/master/LICENSE). |
| 106 | + |
| 107 | +The license tells you what rights you have that are provided by the copyright holder. It is important that the contributor fully understands what rights they are licensing and agrees to them. Sometimes the copyright holder isn't the contributor, such as when the contributor is doing work on behalf of a company. |
| 108 | + |
| 109 | +To make a good faith effort to ensure these criteria are met, we requires the Developer Certificate of Origin (DCO) process to be followed. |
| 110 | + |
| 111 | +The DCO is an attestation attached to every contribution made by every developer. In the commit message of the contribution, the developer simply adds a Signed-off-by statement and thereby agrees to the DCO, which you can find below or at <http://developercertificate.org/>. |
| 112 | + |
| 113 | +``` |
| 114 | +Developer's Certificate of Origin 1.1 |
| 115 | +
|
| 116 | +By making a contribution to this project, I certify that: |
| 117 | +
|
| 118 | +(a) The contribution was created in whole or in part by me and I |
| 119 | + have the right to submit it under the open source license |
| 120 | + indicated in the file; or |
| 121 | +
|
| 122 | +(b) The contribution is based upon previous work that, to the |
| 123 | + best of my knowledge, is covered under an appropriate open |
| 124 | + source license and I have the right under that license to |
| 125 | + submit that work with modifications, whether created in whole |
| 126 | + or in part by me, under the same open source license (unless |
| 127 | + I am permitted to submit under a different license), as |
| 128 | + Indicated in the file; or |
| 129 | +
|
| 130 | +(c) The contribution was provided directly to me by some other |
| 131 | + person who certified (a), (b) or (c) and I have not modified |
| 132 | + it. |
| 133 | +
|
| 134 | +(d) I understand and agree that this project and the contribution |
| 135 | + are public and that a record of the contribution (including |
| 136 | + all personal information I submit with it, including my |
| 137 | + sign-off) is maintained indefinitely and may be redistributed |
| 138 | + consistent with this project or the open source license(s) |
| 139 | + involved. |
| 140 | +``` |
| 141 | + |
| 142 | +#### DCO Sign-Off Methods |
| 143 | + |
| 144 | +The DCO requires a sign-off message in the following format appear on each commit in the pull request: |
| 145 | + |
| 146 | +``` |
| 147 | +Signed-off-by: George Bluth <[email protected]> |
| 148 | +``` |
| 149 | + |
| 150 | +The DCO text can either be manually added to your commit body, or you can add either **-s** or **--signoff** to your usual git commit commands. If you forget to add the sign-off you can also amend a previous commit with the sign-off by running **git commit --amend -s**. If you've pushed your changes to Github already you'll need to force push your branch after this with **git push -f**. |
0 commit comments