Skip to content

Commit a4b9841

Browse files
authored
Merge pull request #1059 from emanic/contributing-fixes
Enhances doc and code contribution guidelines
2 parents 1c5e20a + 6bc6996 commit a4b9841

File tree

5 files changed

+111
-113
lines changed

5 files changed

+111
-113
lines changed

master/reference/contribute.md renamed to CONTRIBUTING_CODE.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
---
2-
title: Contribution Guidelines
3-
---
1+
# Contributing to the Calico Codebase
2+
3+
## Overview
44

55
Features or any changes to the codebase should be done as follows:
66

77
1. Pull latest code in the **master** branch and create a feature
88
branch off this.
9-
2. Implement your feature. Commits are cheap in Git, try to split up
9+
1. Implement your feature. Commits are cheap in Git; try to split up
1010
your code into many. It makes reviewing easier as well as for
1111
saner merging.
1212
- If your commit fixes an existing issue \#123, include the text
@@ -15,11 +15,11 @@ Features or any changes to the codebase should be done as follows:
1515
[How do you attach a new pull request to an existing issue on
1616
GitHub?](https://stackoverflow.com/questions/4528869/how-do-you-attach-a-new-pull-request-to-an-existing-issue-on-github)).
1717

18-
3. Push your feature branch to GitHub. Note that before we can accept
18+
1. Push your feature branch to GitHub. Note that before we can accept
1919
your changes, you need to agree to one of our
2020
contributor agreements. See [below](#contributor-agreements).
21-
4. Create a pull request using GitHub, from your branch to master.
22-
5. Reviewer process:
21+
1. Create a pull request using GitHub, from your branch to master.
22+
1. Reviewer process:
2323
- Receive notice of review by GitHub email, GitHub notification,
2424
or by checking your assigned issues.
2525
- Make markups as comments on the pull request (either line
@@ -31,7 +31,7 @@ Features or any changes to the codebase should be done as follows:
3131
branch. Otherwise, assign the pull request to the developer and
3232
leave this to them.
3333

34-
6. Developer process:
34+
1. Developer process:
3535
- Await review.
3636
- Address code review issues on your feature branch.
3737
- Push your changes to the feature branch on GitHub. This
@@ -46,7 +46,6 @@ Features or any changes to the codebase should be done as follows:
4646

4747
## Contributor Agreements
4848

49-
If you plan to contribute in the form of documentation or code, we need
50-
you to sign our Contributor License Agreement before we can accept your
49+
We need you to sign our Contributor License Agreement before we can accept your
5150
contribution. You will be prompted to do this as part of the PR process
52-
on Github.
51+
on GitHub.

CONTRIBUTING_DOCS.md

+85-86
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,142 @@
1-
# Contributing to Calico Docs
1+
# Contributing to Calico documentation
22

3-
## Building
3+
## Overview
44

5-
The docs require jekyll, a ruby gem. Install the `github-pages` gem which includes
6-
`jekyll` to ensure you are using the exact version of jekyll that github pages
7-
is using to serve the live site.
5+
We welcome contributions to the Calico documentation.
6+
7+
Instead of filing a GitHub issue, consider making a PR instead. You are likely to see a much more rapid resolution.
8+
9+
The doc contribution process works as follows.
10+
11+
1. Fork the [Project Calico repo](https://github.com/projectcalico/calico).
12+
1. Create a branch in your fork off of the master branch.
13+
1. Give your branch a short but descriptive name.
14+
1. Make your changes in the `master` folder.
15+
1. [Build the site locally to make sure it renders as expected](#building-the-doc-site-locally).
16+
1. [Check for broken links](#checking-for-broken-links).
17+
1. Submit a pull request (PR) against the master branch of the [Project Calico repo](https://github.com/projectcalico/calico).
18+
1. If you haven't already signed our contributer agreement, GitHub will prompt you to do so (required).
19+
1. Request a review from one or more Calico maintainers.
20+
1. After getting the approval of at least one Calico maintainer, we ask that you [backport the changes in the `master` folder to the folders of the last two releases](#how-to-quickly-apply-changes-in-master-to-a-previous-release), if appropriate.
21+
1. Squash your commits.
22+
1. One of the doc repo maintainers will give the PR a final look and then merge it.
23+
1. The merge into master will kick off a new build of the live site. You should see your changes on the live site shortly after they are merged.
24+
25+
> **Note**: For contributions that affect just one page, you can use the **Edit this page** buttons in the doc site. This allows you to skip a few steps in the process outlined above, but is suitable only for small contributions.
26+
27+
We also encourage you to review [Doc site organization](#doc-site-organization), [Doc site architecture](#doc-site-architecture), [Linking content](#linking-content), and [RELEASING.md](RELEASING.md) for additional information.
828

9-
```
10-
gem install github-pages
11-
jekyll serve -I
12-
```
1329

14-
>Note:As more versioned directories are created, build speeds will increase by a
15-
factor of 2. The `-I` is an optional flag for development that enables
16-
incremental builds, allowing jekyll to only rebuild changed files. This should
17-
keep subsequent builds down to less than one second.
30+
## Building the doc site locally
1831

32+
We use GitHub Pages and Jekyll to serve and build our site. While there are [several ways to build the site locally](https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/), we recommend using our Docker image and the Makefile in the root of the repo. These will allow you to build the site with a single command.
1933

20-
Alternatively, you can easily volume mount the source files into the official jekyll docker image via using a simple makefile step:
34+
> **Prerequisite**: [Docker](https://docs.docker.com/engine/installation/).
35+
36+
Navigate into the root of the repo and issue the following command from a terminal prompt.
2137

2238
```
2339
make serve
2440
```
2541

26-
As the output states, docs should then be viewable at http://localhost:4000/ .
42+
Once the build completes, it returns a URL as the value of `Server address:`. Copy and paste this URL into your browser to view the site.
2743

28-
### Faster builds
44+
> **Note**: To view the changes that you've made in the master branch, select **nightly** from the **Version** list box.
45+
46+
> **Pro tip**: Jekyll can take a while to render every page. To speed up builds, a supplemental `_config_dev.yml` exists which excludes all directories except `master`. You can include it in your builds as follows `jekyll serve --config _config.yml,_config_dev.yml`. Alternatively, you can pass enable it in `make` using the following environment variable `DEV=true make serve`.
2947
30-
Jekyll can take a while to render every page. To speed up builds, a supplemental `_config_dev.yml` exists which excludes all
31-
directories except `master`. Include it in your builds:
3248

33-
```
34-
jekyll serve --config _config.yml,_config_dev.yml
35-
```
3649

37-
Or pass enable it in make using the environment variable:
50+
## Checking for broken links
51+
52+
> **Prerequisite**: [Docker](https://docs.docker.com/engine/installation/).
53+
54+
To check for broken links, navigate into the root of the repo and issue the following command from a terminal prompt.
3855

3956
```
40-
DEV=true make serve
57+
make htmlproofer
4158
```
4259

43-
### Versioning & Branches
60+
The submission of a PR kicks off a continuous integration process which includes a `make htmlproofer` command. Any errors from `htmlproofer` will cause your PR to fail the continuous integration test, so it's best to run this locally before submitting your PR.
4461

45-
The live site is generated from the master branch of this repository.
62+
However, you can also run this after submitting your PR and experiencing an `htmlproofer` failure from the Semaphore job.
4663

47-
Documentation for past releases is maintained as a folder in the root of this repository.
4864

49-
Most pull requests which modify information in the docs should primarily target
50-
the `/master/` folder, especially if they are describing newly added features.
51-
However, changes should also be applied to past-release directories if they fix
52-
general typos or incorrect information.
65+
## How to quickly apply changes in master to a previous release
5366

54-
##### How to Quickly Back-Apply Master Changes to a Previous Release
55-
Let's say there's a single commit that makes changes to Master which I want
56-
to apply to the v1.5 directory. First, generate a diff:
57-
```
58-
git diff f35c02fe73e6a64d187ee3f6e9298ca47ded91ab^1 f35c02fe73e6a64d187ee3f6e9298ca47ded91ab > my-patch.diff
59-
```
67+
Let's say there's a single commit that makes changes to the `master` directory which I want to apply to the `v1.5` directory.
6068

61-
Then, apply that diff to the target version directory.
62-
```
63-
git apply -p2 --directory=v1.5 my-patch.diff
64-
```
65-
- `-p2` strips off /master on the front of the paths.
66-
- `--directory=v1.5` adds "v1.5" to the start of the paths.
69+
1. Generate a diff. A sample command follows which stores the diff in a file called `my-patch.diff`.
70+
71+
```
72+
git diff f35c02fe73e6a64d187ee3f6e9298ca47ded91ab^1 f35c02fe73e6a64d187ee3f6e9298ca47ded91ab > my-patch.diff
73+
```
74+
75+
1. Apply the diff to the target version directory.
76+
77+
```
78+
git apply -p2 --directory=v1.5 my-patch.diff
79+
```
80+
81+
- `-p2` strips off /master on the front of the paths.
82+
- `--directory=v1.5` adds "v1.5" to the start of the paths.
83+
84+
1. Inspect the results (`git status`, `git diff`, etc.) and commit.
6785
68-
Then simply inspect the results (`git status`, `git diff`, etc.) and commit.
86+
## Doc site organization
6987
70-
## Navigation & Sidebar
88+
### Overview
7189
72-
The docs (currently) are split into 4 main sections:
90+
The docs (currently) are split into four main sections.
7391
74-
- Introduction
75-
- Getting Started
76-
- Using
77-
- Reference
92+
- [Introduction](#introduction)
93+
- [Getting started](#getting-started)
94+
- [Usage](#usage)
95+
- [Reference](#reference)
7896
7997
### Introduction
8098
8199
Landing page for new users covering Calico's purpose and high-level topics.
82100
83-
### Getting Started
101+
### Getting started
84102
85-
This should be where new users go. It includes quick-start guides, some basic
86-
tutorials to show off Calico's capabilities, and links to more advanced topics
87-
once users are comfortable with the basics.
103+
This should be where new users go. It includes quick-start guides, some basic tutorials to show off Calico's capabilities, and links to more advanced topics once users are comfortable with the basics.
88104
89-
Each orchestrator has a landing page that is targeted at people who are coming
90-
to see Calico for the first time. It's a transition from the "marketing" type
91-
material (why is Calico great) to some quick commands people can run to see it
92-
firsthand, and then funnels people off to the usage section for more details.
105+
Each orchestrator has a landing page that is targeted at people who are coming to see Calico for the first time. It's a transition from the "marketing" type material (why is Calico great) to some quick commands people can run to see it firsthand, and then funnels people off to the Usage section for more details.
93106
94107
### Usage
95108
96-
These should all be docs that are a "verb" and task focused. Each doc should
97-
contain why you want to do this, a goal, and a set of steps you can follow to
98-
achieve it. They should not be detailed description of components or tabulated
99-
configuration information.
109+
This section contains task-based information. All top-level titles in this section should start with a gerund. Each topic should include why you want to perform the task, a goal, and a set of steps you can follow to achieve it.
100110
101111
Examples:
102112
103-
- Configuring BGP Peers
113+
- Configuring BGP peers
104114
- Enabling IP-in-IP in AWS
105115
- Troubleshooting Calico
106116
- Using calicoctl in a Kubernetes deployment
107-
- Configuring Egress Policy in Kubernetes
117+
- Configuring egress policy in Kubernetes
118+
119+
Do not include detailed description of components or tabulated
120+
configuration information in this section. This type of content should be located in the [Reference](#reference) section.
108121
109122
### Reference
110123
111-
These docs are complete reference for Calico. If there's a configuration
112-
option you're looking for, it goes here in one of the per-component
113-
references. Not every option has a "how to" guide, but has enough description.
114-
The caveats and considerations when enabling options should be listed here.
124+
These docs contain complete reference information for Calico. If there's a configuration option you're looking for, it goes here in one of the per-component references. Not every option has a "how to" guide, but has enough description. The caveats and considerations when enabling options should be listed here.
115125
116126
Examples:
117127
118-
- Fully tabulated configuration options per-component.
119-
- calicoctl help text.
128+
- Fully tabulated configuration options per-component
129+
- `calicoctl` help text
120130
- Calico API schema reference (policy, ip pool, etcd)
121-
- High-level Calico architecture documentation. (?)
122131
123-
#### How It Works
124132
125-
The naming and layout of these navbars are stored in `_data/$VERSION/navbars/*`. Jekyll automatically stores information from the `_data` dir in an accessible variable called `site.data`. The toplevel layout (`_layout/docwithnav.html`) will iterate through all the files in `site.data[version].navbars` to construct the sidebar based on which version is being viewed.
133+
## Doc site architecture
126134
127-
> Note: Sidebar paths to index files (see next section) should end in a `/` in the yaml file. Sidebar paths to actual files should not end in a `/` in the yaml file.
135+
The naming and layout of these navbars are stored in `_data/$VERSION/navbars/*`. Jekyll automatically stores information from the `_data` directory in an accessible variable called `site.data`. The top-level layout (`_layout/docwithnav.html`) will iterate through all the files in `site.data[version].navbars` to construct the sidebar based on which version is being viewed.
128136
129-
## Pathing
137+
> **Note**: Sidebar paths to index files (see [next section](#linking-content)) should end in a `/` in the yaml file. Sidebar paths to actual files should not end in a `/` in the yaml file.
130138
131-
URL structure is important. In order to create a toplevel splash page for a URL path, simply name the file `index.md`. See the following example:
139+
URL structure is important. In order to create a top level splash page for a URL path, simply name the file `index.md`. See the following example:
132140
133141
134142
| URL | Filepath |
@@ -137,22 +145,13 @@ URL structure is important. In order to create a toplevel splash page for a URL
137145
| `/getting-started/kubernetes/troubleshooting` | `/getting-started/kubernetes/troubleshooting.md` |
138146
139147
140-
## Linking Content
148+
## Linking content
141149
142150
All links should be absolute links. To link to versioned content, prefix all links with: `{{site.baseurl}}/{{page.version}}/`
143151
144-
> Tip: `page.version` will be inherited from the default set in `_config.yml` for the current page's directory.
152+
> **Pro tip**: `page.version` will be inherited from the default set in `_config.yml` for the current page's directory.
145153
146154
## Releases
147155
148156
See [RELEASING.md](RELEASING.md)
149157
150-
## Testing
151-
152-
Print all broken links: `make htmlproofer`
153-
154-
Calico/node system tests run in a container to ensure all build dependencies are met.
155-
156-
```
157-
make -C calico_node st
158-
```

_config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ exclude:
1717
- RELEASING.md
1818
- BUILDING_CALICO.md
1919
- CONTRIBUTING_DOCS.md
20+
- CONTRIBUTING_CODE.md
2021
- hack
2122
- calico_node
2223

_data/master/navbars/reference.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ toc:
132132
path: /reference/requirements
133133
- title: Repo Structure
134134
path: /reference/repo-structure
135-
- title: Contribute
136-
path: /reference/contribute
137-
- title: Involved
135+
- title: Get Involved
138136
path: /reference/involved
139137
- title: License
140138
path: /reference/license

master/reference/involved.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@ in touch for help debugging any issues with Calico.
1818
All of Calico's code is on [GitHub](https://github.com/projectcalico). The following
1919
list contains the most commonly encountered repositories:
2020

21-
Repository | Description
22-
-------------------|----------------------------
23-
[felix](https://github.com/projectcalico/felix) | The felix policy enforcement agent.
24-
[calicoctl](https://github.com/projectcalico/calicoctl) | Home of the calico/node and calicoctl components.
25-
[cni-plugin](https://github.com/projectcalico/cni-plugin) | The Calico CNI plugin.
26-
[libnetwork-plugin](https://github.com/projectcalico/libnetwork-plugin) | The Calico libnetwork plugin for Docker.
27-
[k8s-policy](https://github.com/projectcalico/k8s-policy) | Kubernetes policy controller.
28-
[libcalico](https://github.com/projectcalico/libcalico) | Python Calico library.
29-
[libcalico-go](https://github.com/projectcalico/libcalico-go) | Golang Calico library.
21+
Repository | Description
22+
------------------------------------------------------------------------|----------------------------
23+
[Calico](https://github.com/projectcalico/calico) | Calico release artifacts and documentation
24+
[calicoctl](https://github.com/projectcalico/calicoctl) | calico/node and calicoctl components
25+
[cni-plugin](https://github.com/projectcalico/cni-plugin) | Calico CNI plugin
26+
[felix](https://github.com/projectcalico/felix) | felix policy enforcement agent
27+
[k8s-policy](https://github.com/projectcalico/k8s-policy) | Kubernetes policy controller
28+
[libcalico](https://github.com/projectcalico/libcalico) | Python Calico library
29+
[libcalico-go](https://github.com/projectcalico/libcalico-go) | Golang Calico library
30+
[libnetwork-plugin](https://github.com/projectcalico/libnetwork-plugin) | Calico libnetwork plugin for Docker
3031

3132
## Contributing
3233

3334
Calico follows the "Fork & Pull" model of collaborative development,
34-
with changes being offered to the main Calico codebase via Pull
35-
Requests. So you can contribute a fix, change or enhancement by forking
35+
with changes being offered to the main Calico codebase via pull
36+
requests. So you can contribute a fix, change, or enhancement by forking
3637
one of our repositories and making a GitHub pull request. If you're
3738
interested in doing that:
3839

3940
- Thanks!
4041
- See the [GitHub docs](https://help.github.com/articles/using-pull-requests) for how
41-
to create a Pull Request.
42-
- Check our [contibution guide](contribute) for more information.
42+
to create a pull request.
43+
- Check the contribution guidelines at the root of each repo for more details.

0 commit comments

Comments
 (0)