index.md 28,3 КБ
Newer Older
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
1
2
3
4
5
6
---
description: Learn how to contribute to GitLab Documentation.
---

# GitLab Documentation guidelines

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
7
GitLab's documentation is [intended as the single source of truth (SSOT)](https://about.gitlab.com/handbook/documentation/) for information about how to configure, use, and troubleshoot GitLab. The documentation contains use cases and usage instructions for every GitLab feature, organized by product area and subject. This includes topics and workflows that span multiple GitLab features, and the use of GitLab with other applications.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
8

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
9
In addition to this page, the following resources can help you craft and contribute documentation:
Mike Lewis's avatar
Mike Lewis включено в состав коммита
10

Mike Lewis's avatar
Mike Lewis включено в состав коммита
11
12
- [Style Guide](styleguide.md) - What belongs in the docs, language guidelines, and more.
- [Structure and template](structure.md) - Learn the typical parts of a doc page and how to write each one.
13
14
- [Workflows](workflow.md) - A landing page for our key workflows:
  - [Documentation process for feature changes](feature-change-workflow.md) - Adding required documentation when developing a GitLab feature.
Merve's avatar
Merve включено в состав коммита
15
  - [Documentation improvement workflow](improvement-workflow.md) - New content not associated with a new feature.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
16
- [Markdown Guide](https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/) - A reference for the markdown implementation used by GitLab's documentation site and about.gitlab.com.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
17
- [Site architecture](site_architecture/index.md) - How docs.gitlab.com is built.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
18

Mike Lewis's avatar
Mike Lewis включено в состав коммита
19
## Source files and rendered web locations
Mike Lewis's avatar
Mike Lewis включено в состав коммита
20

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
21
Documentation for GitLab Community Edition (CE), Enterprise Edition (EE), GitLab Runner, and Omnibus is published to [docs.gitlab.com](https://docs.gitlab.com). Documentation for CE and EE is also published within the application at `/help` on the domain of the GitLab instance.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
22

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
23
At `/help`, only help for your current edition and version is included. Help for other versions is available at docs.gitlab.com.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
24

Mike Lewis's avatar
Mike Lewis включено в состав коммита
25
The source of the documentation exists within the codebase of each GitLab application in the following repository locations:
Mike Lewis's avatar
Mike Lewis включено в состав коммита
26
27
28
29

| Project | Path |
| --- | --- |
| [GitLab Community Edition](https://gitlab.com/gitlab-org/gitlab-ce/) | [`/doc`](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc) |
Merve's avatar
Merve включено в состав коммита
30
| [GitLab Enterprise Edition](https://gitlab.com/gitlab-org/gitlab-ee/) | [`/doc`](https://gitlab.com/gitlab-org/gitlab-ee/tree/master/doc) |
Mike Lewis's avatar
Mike Lewis включено в состав коммита
31
32
33
34
35
| [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-runner/) | [`/docs`](https://gitlab.com/gitlab-org/gitlab-runner/tree/master/docs) |
| [Omnibus GitLab](https://gitlab.com/gitlab-org/omnibus-gitlab/) | [`/doc`](https://gitlab.com/gitlab-org/gitlab-ee/tree/master/doc) |

Documentation issues and merge requests are part of their respective repositories and all have the label `Documentation`.

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
36
37
## Contributing to docs

Mike Lewis's avatar
Mike Lewis включено в состав коммита
38
[Contributions to GitLab docs](workflow.md) are welcome from the entire GitLab community.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
39

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
40
To ensure that GitLab docs are current, there are special processes and responsibilities for all [feature changes](feature-change-workflow.md)—i.e. development work that impacts the appearance, usage, or administration of a feature.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
41

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
42
However, anyone can contribute [documentation improvements](improvement-workflow.md) that are not associated with a feature change. For example, adding a new doc on how to accomplish a use case that's already possible with GitLab or with third-party tools and GitLab.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
43

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
44
45
## Markdown and styles

Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
46
[GitLab docs](https://gitlab.com/gitlab-org/gitlab-docs) uses [GitLab Kramdown](https://gitlab.com/gitlab-org/gitlab_kramdown)
Mike Lewis's avatar
Mike Lewis включено в состав коммита
47
as its markdown rendering engine. See the [GitLab Markdown Guide](https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/) for a complete Kramdown reference.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
48

Mike Lewis's avatar
Mike Lewis включено в состав коммита
49
Adhere to the [Documentation Style Guide](styleguide.md). If a style standard is missing, you are welcome to suggest one via a merge request.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
50

Mike Lewis's avatar
Mike Lewis включено в состав коммита
51
52
## Folder structure and files

Mike Lewis's avatar
Mike Lewis включено в состав коммита
53
See the [Structure](styleguide.md#structure) section of the [Documentation Style Guide](styleguide.md).
Mike Lewis's avatar
Mike Lewis включено в состав коммита
54

Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
55
56
## Single codebase

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
57
We maintain two sets of docs: one in the
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
58
59
[gitlab-ce](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc) repo and
one in [gitlab-ee](https://gitlab.com/gitlab-org/gitlab-ee/tree/master/doc).
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
60
These are identical, but they are different repositories.
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
61
62
63

### CE first

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
64
All merge requests for documentation must be submitted to CE. This means that:
Markus Koller's avatar
Markus Koller включено в состав коммита
65

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
66
- For **EE-only docs changes**, you only have to submit an MR in the CE project.
Evan Read's avatar
Evan Read включено в состав коммита
67
- For **EE-only features** that touch both the code and the docs, you have to submit
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
68
  an EE MR containing all code changes, and a CE MR containing only the docs changes
Evan Read's avatar
Evan Read включено в состав коммита
69
  and without a changelog entry.
Markus Koller's avatar
Markus Koller включено в состав коммита
70
71

This might seem like a duplicate effort, but it's only for the short term.
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
72

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
73
Since the CE and EE docs are combined, it's crucial to add the relevant
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
74
[product badges](styleguide.md#product-badges) for all EE documentation, so that
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
75
we can determine which features belong to which tier.
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
76
77
78
79
80

### EE specific lines check

There's a special test in place
([`ee_specific_check.rb`](https://gitlab.com/gitlab-org/gitlab-ee/blob/master/scripts/ee_specific_check/ee_specific_check.rb)),
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
81
which checks and prevents creating or editing new files or directories
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
82
83
84
in EE under `doc/`. This should fail when changes to anything in `/doc` are submitted
in an EE MR. To pass the test, simply remove the docs changes from the EE MR, and
[submit them in CE](#ce-first).
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
85

Mike Lewis's avatar
Mike Lewis включено в состав коммита
86
## Changing document location
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
87

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
88
Changing a document's location requires specific steps to ensure that
Shan's avatar
Shan включено в состав коммита
89
users can seamlessly access the new doc page, whether they are accessing content
Mike Lewis's avatar
Mike Lewis включено в состав коммита
90
on a GitLab instance domain at `/help` or at docs.gitlab.com. Be sure to ping a
Mike Lewis's avatar
Mike Lewis включено в состав коммита
91
92
93
GitLab technical writer if you have any questions during the process (such as
whether the move is necessary), and ensure that a technical writer reviews this
change prior to merging.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
94

Mike Lewis's avatar
Mike Lewis включено в состав коммита
95
If you indeed need to change a document's location, do not remove the old
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
96
document, but instead replace all of its content with a new line:
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
97

Evan Read's avatar
Evan Read включено в состав коммита
98
```md
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
99
100
101
102
103
104
105
This document was moved to [another location](path/to/new_doc.md).
```

where `path/to/new_doc.md` is the relative path to the root directory `doc/`.

---

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
106
For example, if you move `doc/workflow/lfs/lfs_administration.md` to
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
107
108
109
110
111
`doc/administration/lfs.md`, then the steps would be:

1. Copy `doc/workflow/lfs/lfs_administration.md` to `doc/administration/lfs.md`
1. Replace the contents of `doc/workflow/lfs/lfs_administration.md` with:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
112
113
114
   ```md
   This document was moved to [another location](../../administration/lfs.md).
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
115
116
117
118
119

1. Find and replace any occurrences of the old location with the new one.
   A quick way to find them is to use `git grep`. First go to the root directory
   where you cloned the `gitlab-ce` repository and then do:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
120
121
122
123
   ```sh
   git grep -n "workflow/lfs/lfs_administration"
   git grep -n "lfs/lfs_administration"
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
124
125
126
127
128
129
130
131
132
133

NOTE: **Note:**
If the document being moved has any Disqus comments on it, there are extra steps
to follow documented just [below](#redirections-for-pages-with-disqus-comments).

Things to note:

- Since we also use inline documentation, except for the documentation itself,
  the document might also be referenced in the views of GitLab (`app/`) which will
  render when visiting `/help`, and sometimes in the testing suite (`spec/`).
Mike Lewis's avatar
Mike Lewis включено в состав коммита
134
  You must search these paths for references to the doc and update them as well.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
135
136
137
138
139
140
141
- The above `git grep` command will search recursively in the directory you run
  it in for `workflow/lfs/lfs_administration` and `lfs/lfs_administration`
  and will print the file and the line where this file is mentioned.
  You may ask why the two greps. Since we use relative paths to link to
  documentation, sometimes it might be useful to search a path deeper.
- The `*.md` extension is not used when a document is linked to GitLab's
  built-in help page, that's why we omit it in `git grep`.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
142
- Use the checklist on the "Change documentation location" MR description template.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
143

Mike Lewis's avatar
Mike Lewis включено в состав коммита
144
### Alternative redirection method
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
145

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
146
You can also replace the content
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
147
148
149
150
151
152
153
154
155
156
of the old file with a frontmatter containing a redirect link:

```yaml
---
redirect_to: '../path/to/file/README.md'
---
```

It supports both full and relative URLs, e.g. `https://docs.gitlab.com/ee/path/to/file.html`, `../path/to/file.html`, `path/to/file.md`. Note that any `*.md` paths will be compiled to `*.html`.

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
157
158
159
160
161
NOTE: **Note:**
This redirection method will not provide a redirect fallback on GitLab `/help`. When using
it, make sure to add a link to the new page on the doc, otherwise it's a dead end for users that
land on the doc via `/help`.

Mike Lewis's avatar
Mike Lewis включено в состав коммита
162
### Redirections for pages with Disqus comments
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
163

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
164
If the documentation page being relocated already has Disqus comments,
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
165
166
167
168
169
170
we need to preserve the Disqus thread.

Disqus uses an identifier per page, and for docs.gitlab.com, the page identifier
is configured to be the page URL. Therefore, when we change the document location,
we need to preserve the old URL as the same Disqus identifier.

Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
171
To do that, add to the frontmatter the variable `disqus_identifier`,
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
172
173
174
175
176
177
178
179
using the old URL as value. For example, let's say I moved the document
available under `https://docs.gitlab.com/my-old-location/README.html` to a new location,
`https://docs.gitlab.com/my-new-location/index.html`.

Into the **new document** frontmatter add the following:

```yaml
---
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
180
disqus_identifier: 'https://docs.gitlab.com/my-old-location/README.html'
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
181
182
183
---
```

Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
184
Note: it is necessary to include the file name in the `disqus_identifier` URL,
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
185
186
187
188
189
even if it's `index.html` or `README.html`.

## Branch naming

If your contribution contains **only** documentation changes, you can speed up
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
190
the CI process by following these branch naming conventions:
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
191

Evan Read's avatar
Evan Read включено в состав коммита
192
193
| Branch name           | Valid example                |
|:----------------------|:-----------------------------|
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
194
195
196
197
198
| Starting with `docs/` | `docs/update-api-issues`     |
| Starting with `docs-` | `docs-update-api-issues`     |
| Ending in `-docs`     | `123-update-api-issues-docs` |

If your branch name matches any of the above, it will run only the docs
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
199
tests. If not, the whole application test suite will run (including docs tests).
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
200
201
202
203
204

## Merge requests for GitLab documentation

Before getting started, make sure you read the introductory section
"[contributing to docs](#contributing-to-docs)" above and the
Mike Lewis's avatar
Mike Lewis включено в состав коммита
205
[documentation workflow](workflow.md).
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
206
207
208
209
210
211

- Use the current [merge request description template](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab/merge_request_templates/Documentation.md)
- Use the correct [branch name](#branch-naming)
- Label the MR `Documentation`
- Assign the correct milestone (see note below)

Mike Lewis's avatar
Mike Lewis включено в состав коммита
212
213
214
Documentation will be merged if it is an improvement on existing content,
represents a good-faith effort to follow the template and style standards,
and is believed to be accurate.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
215

Mike Lewis's avatar
Mike Lewis включено в состав коммита
216
217
Further needs for what would make the doc even better should be immediately addressed
in a follow-up MR or issue.
Mike Lewis's avatar
Mike Lewis включено в состав коммита
218

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
NOTE: **Note:**
If the release version you want to add the documentation to has already been
frozen or released, use the label `Pick into X.Y` to get it merged into
the correct release. Avoid picking into a past release as much as you can, as
it increases the work of the release managers.

### Cherry-picking from CE to EE

As we have the `master` branch of CE merged into EE once a day, it's common to
run into merge conflicts. To avoid them, we [test for merge conflicts against EE](#testing)
with the `ee-compat-check` job, and use the following method of creating equivalent
branches for CE and EE.

Follow this [method for cherry-picking from CE to EE](../automatic_ce_ee_merge.md#cherry-picking-from-ce-to-ee), with a few adjustments:

- Create the [CE branch](#branch-naming) starting with `docs-`,
  e.g.: `git checkout -b docs-example`
- Create the EE-equivalent branch ending with `-ee`, e.g.,
  `git checkout -b docs-example-ee`
- Once all the jobs are passing in CE and EE, and you've addressed the
Evan Read's avatar
Evan Read включено в состав коммита
239
  feedback from your own team, assign the CE MR to a technical writer for review
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
240
- When both MRs are ready, the EE merge request will be merged first, and the
Evan Read's avatar
Evan Read включено в состав коммита
241
  CE-equivalent will be merged next.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
242
- Note that the review will occur only in the CE MR, as the EE MR
Evan Read's avatar
Evan Read включено в состав коммита
243
  contains the same commits as the CE MR.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
244
- If you have a few more changes that apply to the EE-version only, you can submit
Evan Read's avatar
Evan Read включено в состав коммита
245
246
247
  a couple more commits to the EE branch, but ask the reviewer to review the EE merge request
  additionally to the CE MR. If there are many EE-only changes though, start a new MR
  to EE only.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
248
249
250

## GitLab `/help`

Mike Lewis's avatar
Mike Lewis включено в состав коммита
251
252
253
254
255
Every GitLab instance includes the documentation, which is available at `/help`
(`https://gitlab.example.com/help`). For example, <https://gitlab.com/help>.

There are [plans](https://gitlab.com/groups/gitlab-org/-/epics/693) to end this
practice and instead link out from the GitLab application to docs.gitlab.com URLs.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
256

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
257
258
The documentation available online on docs.gitlab.com is continuously
deployed every hour from the `master` branch of CE, EE, Omnibus, and Runner. Therefore,
Evan Read's avatar
Evan Read включено в состав коммита
259
260
once a merge request gets merged, it will be available online on the same day.
However, they will be shipped (and available on `/help`) within the milestone assigned
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
261
262
263
264
265
266
267
268
269
270
271
272
to the MR.

For instance, let's say your merge request has a milestone set to 11.3, which
will be released on 2018-09-22. If it gets merged on 2018-09-15, it will be
available online on 2018-09-15, but, as the feature freeze date has passed, if
the MR does not have a "pick into 11.3" label, the milestone has to be changed
to 11.4 and it will be shipped with all GitLab packages only on 2018-10-22,
with GitLab 11.4. Meaning, it will only be available under `/help` from GitLab
11.4 onwards, but available on docs.gitlab.com on the same day it was merged.

### Linking to `/help`

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
When you're building a new feature, you may need to link the documentation
from GitLab, the application. This is normally done in files inside the
`app/views/` directory with the help of the `help_page_path` helper method.

In its simplest form, the HAML code to generate a link to the `/help` page is:

```haml
= link_to 'Help page', help_page_path('user/permissions')
```

The `help_page_path` contains the path to the document you want to link to with
the following conventions:

- it is relative to the `doc/` directory in the GitLab repository
- the `.md` extension must be omitted
- it must not end with a slash (`/`)

Below are some special cases where should be used depending on the context.
You can combine one or more of the following:

1. **Linking to an anchor link.** Use `anchor` as part of the `help_page_path`
   method:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
296
297
298
   ```haml
   = link_to 'Help page', help_page_path('user/permissions', anchor: 'anchor-link')
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
299
300
301

1. **Opening links in a new tab.** This should be the default behavior:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
302
303
304
   ```haml
   = link_to 'Help page', help_page_path('user/permissions'), target: '_blank'
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
305
306
307
308
309

1. **Linking to a circle icon.** Usually used in settings where a long
   description cannot be used, like near checkboxes. You can basically use
   any font awesome icon, but prefer the `question-circle`:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
310
311
312
   ```haml
   = link_to icon('question-circle'), help_page_path('user/permissions')
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
313
314
315
316

1. **Using a button link.** Useful in places where text would be out of context
   with the rest of the page layout:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
317
318
319
   ```haml
   = link_to 'Help page', help_page_path('user/permissions'),  class: 'btn btn-info'
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
320
321
322

1. **Using links inline of some text.**

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
323
324
325
   ```haml
   Description to #{link_to 'Help page', help_page_path('user/permissions')}.
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
326
327
328
329

1. **Adding a period at the end of the sentence.** Useful when you don't want
   the period to be part of the link:

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
330
331
332
333
334
   ```haml
   = succeed '.' do
     Learn more in the
     = link_to 'Help page', help_page_path('user/permissions')
   ```
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
335

Evan Read's avatar
Evan Read включено в состав коммита
336
337
338
339
340
341
342
343
344
345
### GitLab `/help` tests

Several [rspec tests](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/spec/features/help_pages_spec.rb)
are run to ensure GitLab documentation renders and works correctly. In particular, that [main docs landing page](../../README.md) will work correctly from `/help`.
For example, [GitLab.com's `/help`](https://gitlab.com/help).

CAUTION: **Caution:**
Because the rspec tests only run in a full pipeline, and not a special [docs-only pipeline](#branch-naming), it is possible
to merge changes that will break `master` from a merge request with a successful docs-only pipeline run.

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
346
347
## Docs site architecture

Mike Lewis's avatar
Mike Lewis включено в состав коммита
348
See the [Docs site architecture](site_architecture/index.md) page to learn
Mike Lewis's avatar
Mike Lewis включено в состав коммита
349
how we build and deploy the site at [docs.gitlab.com](https://docs.gitlab.com) and
Mike Lewis's avatar
Mike Lewis включено в состав коммита
350
to review all the assets and libraries in use.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
351
352
353

### Global navigation

Mike Lewis's avatar
Mike Lewis включено в состав коммита
354
355
See the [Global navigation](site_architecture/global_nav.md) doc for information
on how the left-side navigation menu is built and updated.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
356

Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
357
358
359
360
## Previewing the changes live

NOTE: **Note:**
To preview your changes to documentation locally, follow this
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
361
[development guide](https://gitlab.com/gitlab-org/gitlab-docs/blob/master/README.md#development-when-contributing-to-gitlab-documentation) or [these instructions for GDK](https://gitlab.com/gitlab-org/gitlab-development-kit/blob/master/doc/howto/gitlab_docs.md).
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
362
363
364
365
366
367
368
369

The live preview is currently enabled for the following projects:

- <https://gitlab.com/gitlab-org/gitlab-ce>
- <https://gitlab.com/gitlab-org/gitlab-ee>
- <https://gitlab.com/gitlab-org/gitlab-runner>

If your branch contains only documentation changes, you can use
Mike Lewis's avatar
Mike Lewis включено в состав коммита
370
[special branch names](#branch-naming) to avoid long-running pipelines.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
371
372
373
374

For [docs-only changes](#branch-naming), the review app is run automatically.
For all other branches, you can use the manual `review-docs-deploy-manual` job
in your merge request. You will need at least Maintainer permissions to be able
Mike Lewis's avatar
Mike Lewis включено в состав коммита
375
376
to run it. In the mini pipeline graph, you should see a `>>` icon. Clicking it will
reveal the `review-docs-deploy-manual` job. Click the play button to start the job.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
377
378
379
380
381
382
383
384

![Manual trigger a docs build](img/manual_build_docs.png)

NOTE: **Note:**
You will need to push a branch to those repositories, it doesn't work for forks.

The `review-docs-deploy*` job will:

Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
385
1. Create a new branch in the [gitlab-docs](https://gitlab.com/gitlab-org/gitlab-docs)
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
386
387
388
389
390
391
392
393
394
395
396
397
398
   project named after the scheme: `$DOCS_GITLAB_REPO_SUFFIX-$CI_ENVIRONMENT_SLUG`,
   where `DOCS_GITLAB_REPO_SUFFIX` is the suffix for each product, e.g, `ce` for
   CE, etc.
1. Trigger a cross project pipeline and build the docs site with your changes

After a few minutes, the Review App will be deployed and you will be able to
preview the changes. The docs URL can be found in two places:

- In the merge request widget
- In the output of the `review-docs-deploy*` job, which also includes the
  triggered pipeline so that you can investigate whether something went wrong

TIP: **Tip:**
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
399
400
Someone with no merge rights to the CE/EE projects (think of forks from
contributors) cannot run the manual job. In that case, you can
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
ask someone from the GitLab team who has the permissions to do that for you.

NOTE: **Note:**
Make sure that you always delete the branch of the merge request you were
working on. If you don't, the remote docs branch won't be removed either,
and the server where the Review Apps are hosted will eventually be out of
disk space.

### Troubleshooting review apps

In case the review app URL returns 404, follow these steps to debug:

1. **Did you follow the URL from the merge request widget?** If yes, then check if
   the link is the same as the one in the job output.
1. **Did you follow the URL from the job output?** If yes, then it means that
   either the site is not yet deployed or something went wrong with the remote
   pipeline. Give it a few minutes and it should appear online, otherwise you
   can check the status of the remote pipeline from the link in the job output.
   If the pipeline failed or got stuck, drop a line in the `#docs` chat channel.

### Technical aspects

If you want to know the in-depth details, here's what's really happening:

1. You manually run the `review-docs-deploy` job in a CE/EE merge request.
1. The job runs the [`scripts/trigger-build-docs`](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/scripts/trigger-build-docs)
   script with the `deploy` flag, which in turn:
   1. Takes your branch name and applies the following:
      - The slug of the branch name is used to avoid special characters since
        ultimately this will be used by NGINX.
      - The `preview-` prefix is added to avoid conflicts if there's a remote branch
        with the same name that you created in the merge request.
      - The final branch name is truncated to 42 characters to avoid filesystem
        limitations with long branch names (> 63 chars).
   1. The remote branch is then created if it doesn't exist (meaning you can
      re-run the manual job as many times as you want and this step will be skipped).
   1. A new cross-project pipeline is triggered in the docs project.
   1. The preview URL is shown both at the job output and in the merge request
      widget. You also get the link to the remote pipeline.
1. In the docs project, the pipeline is created and it
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
441
   [skips the test jobs](https://gitlab.com/gitlab-org/gitlab-docs/blob/8d5d5c750c602a835614b02f9db42ead1c4b2f5e/.gitlab-ci.yml#L50-55)
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
442
443
444
445
446
447
448
449
   to lower the build time.
1. Once the docs site is built, the HTML files are uploaded as artifacts.
1. A specific Runner tied only to the docs project, runs the Review App job
   that downloads the artifacts and uses `rsync` to transfer the files over
   to a location where NGINX serves them.

The following GitLab features are used among others:

Evan Read's avatar
Evan Read включено в состав коммита
450
- [Manual actions](../../ci/yaml/README.md#whenmanual)
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
451
- [Multi project pipelines](../../ci/multi_project_pipeline_graphs.md)
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
452
453
454
455
456
457
- [Review Apps](../../ci/review_apps/index.md)
- [Artifacts](../../ci/yaml/README.md#artifacts)
- [Specific Runner](../../ci/runners/README.md#locking-a-specific-runner-from-being-enabled-for-other-projects)

## Testing

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
458
459
We treat documentation as code, and so use tests to maintain the standards and quality of the docs.
The current tests are:
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
460
461
462

1. `docs lint`: Check that all internal (relative) links work correctly and
   that all cURL examples in API docs use the full switches. It's recommended
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
463
   to [check locally](#previewing-the-changes-live) before pushing to GitLab by executing the command
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
464
   `bundle exec nanoc check internal_links` on your local
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
465
   [`gitlab-docs`](https://gitlab.com/gitlab-org/gitlab-docs) directory. In addition,
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
466
   `docs-lint` also runs [`markdownlint`](#markdownlint) to ensure the
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
467
   markdown is consistent across all documentation.
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
468
1. [`ee_compat_check`](../automatic_ce_ee_merge.md#avoiding-ce-ee-merge-conflicts-beforehand) (runs on CE only):
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
469
470
471
472
473
474
475
   When you submit a merge request to GitLab Community Edition (CE),
   there is this additional job that runs against Enterprise Edition (EE)
   and checks if your changes can apply cleanly to the EE codebase.
   If that job fails, read the instructions in the job log for what to do next.
   As CE is merged into EE once a day, it's important to avoid merge conflicts.
   Submitting an EE-equivalent merge request cherry-picking all commits from CE to EE is
   essential to avoid them.
Achilleas Pipinellis's avatar
Achilleas Pipinellis включено в состав коммита
476
477
478
479
1. [`ee-files-location-check`/`ee-specific-lines-check`](#ee-specific-lines-check) (runs on EE only):
   This test ensures that no new files/directories are created/changed in EE.
   All docs should be submitted in CE instead, regardless the tier they are on.
   This is for the [single codebase](#single-codebase) effort.
Evan Read's avatar
Evan Read включено в состав коммита
480
1. In a full pipeline, tests for [`/help`](#gitlab-help-tests).
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
481
482
483

### Linting

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
484
To help adhere to the [documentation style guidelines](styleguide.md), and improve the content
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
485
486
487
488
489
490
added to documentation, consider locally installing and running documentation linters. This will
help you catch common issues before raising merge requests for review of documentation.

The following are some suggested linters you can install locally and sample configuration:

- [`proselint`](#proselint)
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
491
- [`markdownlint`](#markdownlint), which is the same as the test run in [`docs-lint`](#testing)
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536

NOTE: **Note:**
This list does not limit what other linters you can add to your local documentation writing toolchain.

#### `proselint`

`proselint` checks for common problems with English prose. It provides a
 [plethora of checks](http://proselint.com/checks/) that are helpful for technical writing.

`proselint` can be used [on the command line](http://proselint.com/utility/), either on a single
 Markdown file or on all Markdown files in a project. For example, to run `proselint` on all
 documentation in the [`gitlab-ce` project](https://gitlab.com/gitlab-org/gitlab-ce), run the
 following commands from within the `gitlab-ce` project:

```sh
cd doc
proselint **/*.md
```

`proselint` can also be run from within editors using plugins. For example, the following plugins
 are available:

- [Sublime Text](https://packagecontrol.io/packages/SublimeLinter-contrib-proselint)
- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=PatrykPeszko.vscode-proselint)
- [Others](https://github.com/amperser/proselint#plugins-for-other-software)

##### Sample `proselint` configuration

All of the checks are good to use. However, excluding the `typography.symbols` and `misc.phrasal_adjectives` checks will reduce
noise. The following sample `proselint` configuration disables these checks:

```json
{
  "checks": {
    "typography.symbols": false,
    "misc.phrasal_adjectives": false
  }
}
```

A file with `proselint` configuration must be placed in a
[valid location](https://github.com/amperser/proselint#checks). For example, `~/.config/proselint/config`.

#### `markdownlint`

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
537
538
539
540
[`markdownlint`](https://github.com/DavidAnson/markdownlint) checks that markdown
syntax follows [certain rules](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#rules),
and is used by the [`docs-lint` test](#testing) with a [configuration file](#markdownlint-configuration).
Our [Documentation Style Guide](styleguide.md#markdown) and [Markdown Guide](https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/)
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
541
elaborate on which choices must be made when selecting Markdown syntax for GitLab
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
542
documentation. This tool helps catch deviations from those guidelines.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
543
544

`markdownlint` can be used [on the command line](https://github.com/igorshubovych/markdownlint-cli#markdownlint-cli--),
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
545
546
either on a single Markdown file or on all Markdown files in a project. For example, to run
`markdownlint` on all documentation in the [`gitlab-ce` project](https://gitlab.com/gitlab-org/gitlab-ce),
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
547
548
549
run the following commands from within your `gitlab-ce` project root directory, which will
automatically detect the [`.markdownlint.json`](#markdownlint-configuration) config
file in the root of the project, and test all files in `/doc` and its subdirectories:
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
550
551

```sh
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
552
markdownlint 'doc/**/*.md'
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
553
554
```

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
555
556
557
558
559
560
561
562
If you wish to use a different config file, use the `-c` flag:

```sh
markdownlint -c <config-file-name> 'doc/**/*.md'
```

`markdownlint` can also be run from within text editors using [plugins/extensions](https://github.com/DavidAnson/markdownlint#related),
such as:
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
563
564
565

- [Sublime Text](https://packagecontrol.io/packages/SublimeLinter-contrib-markdownlint)
- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
566
- [Atom](https://atom.io/packages/linter-node-markdownlint)
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
567

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
568
569
570
571
It is best to use the [same configuration file](#markdownlint-configuration) as what
is in use in the four repos that are the sources for <https://docs.gitlab.com>. Each
plugin/extension has different requirements regarding the configuration file, which
is explained in each editor's docs.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
572

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
573
##### `markdownlint` configuration
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
574

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
575
576
577
578
Each formatting issue that `markdownlint` checks has an associated
[rule](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#rules).
These rules are configured in the `.markdownlint.json` files located in the root of
four repos that are the sources for <https://docs.gitlab.com>:
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
579

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
580
581
582
583
- <https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.markdownlint.json>
- <https://gitlab.com/gitlab-org/gitlab-runner/blob/master/.markdownlint.json>
- <https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/.markdownlint.json>
- <https://gitlab.com/charts/gitlab/blob/master/.markdownlint.json>
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
584

Marcel Amirault's avatar
Marcel Amirault включено в состав коммита
585
586
By default all rules are enabled, so the configuration file is used to disable unwanted
rules, and also to configure optional parameters for enabled rules as needed.
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
587

Mike Lewis's avatar
Mike Lewis включено в состав коммита
588
## Danger Bot
Marcia Ramos's avatar
Marcia Ramos включено в состав коммита
589

Mike Lewis's avatar
Mike Lewis включено в состав коммита
590
591
592
593
594
GitLab uses [Danger](https://github.com/danger/danger) for some elements in
code review. For docs changes in merge requests, whenever a change to files under `/doc`
is made, Danger Bot leaves a comment with further instructions about the documentation
process. This is configured in the Dangerfile in the GitLab CE and EE repo under
[/danger/documentation/](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/danger/documentation).