|
1 | | -# How to Contribute |
| 1 | +# <a name="contributing">Contributing Overview</a> |
| 2 | +Please do! Thanks for your help improving the project! 🎈 |
2 | 3 |
|
3 | | -We'd love to accept your patches and contributions to this project. There are |
4 | | -just a few small guidelines you need to follow. |
| 4 | +All contributors are welcome. Please see the [newcomers welcome guide](https://layer5.io/community/newcomers) for how, where and why to contribute. This project is community-built and welcomes collaboration. Contributors are expected to adhere to our [Code of Conduct](CODE_OF_CONDUCT.md). |
5 | 5 |
|
6 | | -## Contributor License Agreement |
| 6 | +Not sure where to start? First, see the [newcomers welcome guide](https://layer5.io/community/newcomers). Grab an open issue with the [help-wanted label](../../labels/help%20wanted) and jump in. Join the [Slack account](http://slack.layer5.io) and engage in conversation. Create a [new issue](/../../issues/new/choose) if needed. All [pull requests](/../../pulls) should reference an open [issue](/../../issues). Include keywords in your pull request descriptions, as well as commit messages, to [automatically close issues in GitHub](https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords). |
7 | 7 |
|
8 | | -Contributions to this project must be accompanied by a Contributor License |
9 | | -Agreement. You (or your employer) retain the copyright to your contribution; |
10 | | -this simply gives us permission to use and redistribute your contributions as |
11 | | -part of the project. Head over to <https://cla.developers.google.com/> to see |
12 | | -your current agreements on file or to sign a new one. |
| 8 | +**Sections** |
| 9 | +- <a name="contributing">General Contribution Flow</a> |
| 10 | + - <a href="#prerequisites">Prerequisites</a> |
| 11 | + - <a href="#set-up-your-local-development-environment">Set up your Local Development Environment</a> |
| 12 | + - <a href="#commit-signing">Developer Certificate of Origin</a> |
13 | 13 |
|
14 | | -You generally only need to submit a CLA once, so if you've already submitted one |
15 | | -(even if it was for a different project), you probably don't need to do it |
16 | | -again. |
| 14 | +Relevant coding style guidelines are the Go Code Review Comments and the Formatting and style section of Peter Bourgon's Go: Best Practices for Production Environments. |
17 | 15 |
|
18 | | -## Code reviews |
| 16 | +# <a name="contributing">General Contribution Flow</a> |
19 | 17 |
|
20 | | -All submissions, including submissions by project members, require review. We |
21 | | -use GitHub pull requests for this purpose. Consult |
22 | | -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more |
23 | | -information on using pull requests. |
| 18 | +In order to contribute to Layer5 docs, please follow the fork-and-pull request workflow described [here](./CONTRIBUTING-gitflow.md). |
24 | 19 |
|
25 | | -## Community Guidelines |
| 20 | +## Prerequisites |
26 | 21 |
|
27 | | -This project follows |
28 | | -[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). |
| 22 | +Make sure you have the following prerequisites installed on your operating system before you start contributing: |
| 23 | + |
| 24 | +- [Nodejs and npm](https://nodejs.org/en/) |
| 25 | + |
| 26 | + To verify run: |
| 27 | + |
| 28 | + ``` |
| 29 | + node -v |
| 30 | + ``` |
| 31 | + |
| 32 | + ``` |
| 33 | + npm -v |
| 34 | + ``` |
| 35 | + |
| 36 | +- [Go](https://go.dev/doc/install) |
| 37 | + |
| 38 | + To verify run: |
| 39 | + |
| 40 | + ``` |
| 41 | + go version |
| 42 | + ``` |
| 43 | + |
| 44 | +- [Hugo](https://gohugo.io/installation/) |
| 45 | + |
| 46 | + |
| 47 | + - Install a recent release of the Hugo "extended" version. If you install from |
| 48 | + the [Hugo release page](https://github.com/gohugoio/hugo/releases), make sure |
| 49 | + you download the `extended` version, which supports SCSS. |
| 50 | + |
| 51 | + To verify run: |
| 52 | + |
| 53 | + ``` |
| 54 | + hugo version |
| 55 | + ``` |
| 56 | +
|
| 57 | + - Install `PostCSS` so that the site build can create the final CSS assets. You |
| 58 | + can install it locally by running the following commands from the root |
| 59 | + directory of your project: |
| 60 | +
|
| 61 | + ```sh |
| 62 | + npm install --save-dev autoprefixer |
| 63 | + npm install --save-dev postcss-cli |
| 64 | + ``` |
| 65 | +
|
| 66 | + Starting in |
| 67 | + [version 8 of `postcss-cli`](https://github.com/postcss/postcss-cli/blob/master/CHANGELOG.md), |
| 68 | + you must also separately install `postcss`: |
| 69 | +
|
| 70 | + ```sh |
| 71 | + npm install -D postcss |
| 72 | + ``` |
| 73 | +
|
| 74 | +**Note:** If you're on a _Windows environment_ then it is highly recommended that you install [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install) both for performance and ease of use. |
| 75 | +
|
| 76 | +
|
| 77 | +## Set up your Local Development Environment |
| 78 | +
|
| 79 | +Follow the following instructions to start contributing. |
| 80 | +
|
| 81 | +**1.** Fork [this](https://github.com/layer5io/exoscale-academy) repository. |
| 82 | +
|
| 83 | +**2.** Clone your forked copy of the project. |
| 84 | +
|
| 85 | +``` |
| 86 | +git clone --depth=1 https://github.com/<your-username>/exoscale-academy.git |
| 87 | +``` |
| 88 | +
|
| 89 | +**3.** Navigate to the project directory. |
| 90 | +
|
| 91 | +``` |
| 92 | +cd exoscale-academy |
| 93 | +``` |
| 94 | +
|
| 95 | +**4.** Add a reference(remote) to the original repository. |
| 96 | +
|
| 97 | +``` |
| 98 | +git remote add upstream https://github.com/layer5io/exoscale-academy.git |
| 99 | +``` |
| 100 | +
|
| 101 | +**5.** Check the remotes for this repository. |
| 102 | +
|
| 103 | +``` |
| 104 | +git remote -v |
| 105 | +``` |
| 106 | +
|
| 107 | +**6.** Always take a pull from the upstream repository to your master branch to keep it at par with the main project (updated repository). |
| 108 | +
|
| 109 | +``` |
| 110 | +git pull upstream master |
| 111 | +``` |
| 112 | +
|
| 113 | +**7.** Create a new branch. |
| 114 | +
|
| 115 | +``` |
| 116 | +git checkout -b <your_branch_name> |
| 117 | +``` |
| 118 | +
|
| 119 | +**8.** Install the dependencies for running the site. |
| 120 | +
|
| 121 | +``` |
| 122 | +make setup |
| 123 | +``` |
| 124 | +
|
| 125 | +**9.** Make the desired changes. |
| 126 | +
|
| 127 | +**10.** Run the site locally to preview changes. |
| 128 | +
|
| 129 | +``` |
| 130 | +make site |
| 131 | +``` |
| 132 | +
|
| 133 | +This will run a local webserver with "live reload" conveniently enabled. ( **NOTE**: while using the make command on Windows, there sometimes arises an error in identifying the command even after it is installed (unrecognized command), this is because the PATH for the binary might not be set correctly ). |
| 134 | +
|
| 135 | +**11.** Track your changes. |
| 136 | +
|
| 137 | +``` |
| 138 | +git add . |
| 139 | +``` |
| 140 | +
|
| 141 | +**12.** Commit your changes. To contribute to this project, you must agree to the [Developer Certificate of Origin (DCO)](#signing-off-on-commits) for each commit you make. |
| 142 | +
|
| 143 | +``` |
| 144 | +git commit --signoff -m "<commit subject>" |
| 145 | +``` |
| 146 | +
|
| 147 | +or you could go with the shorter format for the same, as shown below. |
| 148 | +
|
| 149 | +``` |
| 150 | +git commit -s -m "<commit subject>" |
| 151 | +``` |
| 152 | +
|
| 153 | +**13.** While you are working on your branch, other developers may update the `master` branch with their branch. This action means your branch is now out of date with the `master` branch and missing content. So to fetch the new changes, follow along: |
| 154 | +
|
| 155 | +``` |
| 156 | +git checkout master |
| 157 | +git fetch origin master |
| 158 | +git merge upstream/master |
| 159 | +git push origin |
| 160 | +``` |
| 161 | +
|
| 162 | +Now you need to merge the `master` branch into your branch. This can be done in the following way: |
| 163 | +
|
| 164 | +``` |
| 165 | +git checkout <your_branch_name> |
| 166 | +git merge master |
| 167 | +``` |
| 168 | +
|
| 169 | +**14.** Push the committed changes in your feature branch to your remote repo. |
| 170 | +
|
| 171 | +``` |
| 172 | +git push -u origin <your_branch_name> |
| 173 | +``` |
| 174 | +
|
| 175 | +**15.** Once you’ve committed and pushed all of your changes to GitHub, go to the page for your fork on GitHub, select your development branch, and click the pull request button. Please ensure that you compare your feature branch to the desired branch of the repo you are supposed to make a PR to. If you need to make any adjustments to your pull request, just push the updates to GitHub. Your pull request will automatically track the changes in your development branch and update it. |
| 176 | +
|
| 177 | +## <a name="commit-signing">Signing-off on Commits (Developer Certificate of Origin)</a> |
| 178 | +
|
| 179 | +To contribute to this project, you must agree to the Developer Certificate of |
| 180 | +Origin (DCO) for each commit you make. The DCO is a simple statement that you, |
| 181 | +as a contributor, have the legal right to make the contribution. |
| 182 | +
|
| 183 | +See the [DCO](https://developercertificate.org) file for the full text of what you must agree to |
| 184 | +and how it works [here](https://github.com/probot/dco#how-it-works). |
| 185 | +To signify that you agree to the DCO for contributions, you simply add a line to each of your |
| 186 | +git commit messages: |
| 187 | +
|
| 188 | +``` |
| 189 | +Signed-off-by: Jane Smith <jane.smith@example.com> |
| 190 | +``` |
| 191 | +
|
| 192 | +In most cases, you can add this signoff to your commit automatically with the |
| 193 | +`-s` or `--signoff` flag to `git commit`. You must use your real name and a reachable email |
| 194 | +address (sorry, no pseudonyms or anonymous contributions). An example of signing off on a commit: |
| 195 | +``` |
| 196 | +$ commit -s -m “my commit message w/signoff” |
| 197 | +``` |
| 198 | +
|
| 199 | +To ensure all your commits are signed, you may choose to add this alias to your global ```.gitconfig```: |
| 200 | +
|
| 201 | +*~/.gitconfig* |
| 202 | +``` |
| 203 | +[alias] |
| 204 | + amend = commit -s --amend |
| 205 | + cm = commit -s -m |
| 206 | + commit = commit -s |
| 207 | +``` |
| 208 | +Or you may configure your IDE, for example, Visual Studio Code to automatically sign-off commits for you: |
| 209 | +
|
| 210 | +<a href="https://user-images.githubusercontent.com/7570704/64490167-98906400-d25a-11e9-8b8a-5f465b854d49.png" ><img src="https://user-images.githubusercontent.com/7570704/64490167-98906400-d25a-11e9-8b8a-5f465b854d49.png" width="50%"><a> |
| 211 | +
|
| 212 | +## <a name="contributing-docs">Documentation Contribution Flow</a> |
| 213 | +Please contribute! Layer5 documentation uses Jekyll and GitHub Pages to host docs sites. Learn more about [Layer5's documentation framework](https://docs.google.com/document/d/17guuaxb0xsfutBCzyj2CT6OZiFnMu9w4PzoILXhRXSo/edit?usp=sharing). The process of contributing follows this flow: |
| 214 | +
|
| 215 | +1. Create a fork, if you have not already, by following the steps described [here](./CONTRIBUTING-gitflow.md) |
| 216 | +1. In the local copy of your fork, navigate to the docs folder. |
| 217 | +`cd docs` |
| 218 | +1. Create and checkout a new branch to make changes within |
| 219 | +`git checkout -b <my-changes>` |
| 220 | +1. Edit/add documentation. |
| 221 | +`vi <specific page>.md` |
| 222 | +1. Run site locally to preview changes. |
| 223 | +`make site` |
| 224 | +1. Commit, [sign-off](#commit-signing), and push changes to your remote branch. |
| 225 | +`git push origin <my-changes>` |
| 226 | +1. Open a pull request (in your web browser) against the repo. |
| 227 | +
|
| 228 | +
|
| 229 | +#### Tests |
| 230 | +Users can now test their code on their local machine against the CI checks implemented using `make run-tests`. |
| 231 | +
|
| 232 | +To test code changes on your local machine, run the following command: |
| 233 | +``` |
| 234 | +make run-tests |
| 235 | +``` |
| 236 | +
|
| 237 | +#### Building Docker image |
| 238 | +To build a Docker image of the project, please ensure you have `Docker` installed to be able to build the image. Now, run the following command to build and serve the files locally.: |
| 239 | +
|
| 240 | +> [!IMPORTANT] |
| 241 | +> This requires Docker Desktop version **4.24** or later, or Docker Engine with Docker |
| 242 | +> Compose version [**2.22**](https://docs.docker.com/compose/file-watch/) or later. |
| 243 | +```sh |
| 244 | +make docker |
| 245 | +``` |
| 246 | + |
| 247 | +### UI Lint Rules |
| 248 | + |
| 249 | +Layer5 uses ES-Lint to maintain code quality & consistency in our UI Code. |
| 250 | + |
| 251 | +# <a name="maintaining"> Reviews</a> |
| 252 | +All contributors are invited to review pull requests. See this short video on [how to review a pull request](https://www.youtube.com/watch?v=isLfo7jfE6g&feature=youtu.be). |
| 253 | + |
| 254 | +# New to Git? |
| 255 | +Resources: https://lab.github.com and https://try.github.com/ |
| 256 | + |
| 257 | +### License |
| 258 | + |
| 259 | +This repository and site are available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0). |
| 260 | + |
| 261 | +### About Layer5 |
| 262 | + |
| 263 | +**Community First** |
| 264 | +<p>The <a href="https://layer5.io/community">Layer5 community</a> represents the largest collection of service mesh projects and their maintainers in the world.</p> |
| 265 | + |
| 266 | +**Open Source First** |
| 267 | +<p>At Layer5, we champion developer-defined infrastructure, giving engineers the power to reshape application delivery. We empower operators in reimagining how they manage modern infrastructure: collaboratively.</p> |
0 commit comments