blob: af46d64042750022314a0b34ac4a58dea7d64371 [file] [log] [blame]
Rich Bennettd504dc82018-05-31 08:40:36 -04001.. This work is licensed under a Creative Commons Attribution 4.0
2.. International License. http://creativecommons.org/licenses/by/4.0
3.. Copyright 2017 AT&T Intellectual Property. All rights reserved.
Rich Bennettac93e0e2017-07-19 01:36:52 -04004
Rich Bennettac93e0e2017-07-19 01:36:52 -04005
Rich Bennett1da30462017-08-24 12:11:36 -04006Setting Up
7==========
jsseidelda2324a2017-09-15 10:43:14 -04008
Rich Bennetta9d6a442017-08-25 02:37:15 -04009Some initial set up is required to connect a project with
Rich Bennett1da30462017-08-24 12:11:36 -040010the master document structure and enable automated publishing of
Blaisonneau David2963ece2017-11-27 10:07:18 +010011changes as summarized in the following diagram and description below
Rich Bennett1da30462017-08-24 12:11:36 -040012below.
Rich Bennettac93e0e2017-07-19 01:36:52 -040013
Rich Bennett1da30462017-08-24 12:11:36 -040014.. seqdiag::
Rich Bennetta9d6a442017-08-25 02:37:15 -040015 :height: 700
16 :width: 1000
Rich Bennettac93e0e2017-07-19 01:36:52 -040017
Rich Bennett1da30462017-08-24 12:11:36 -040018 seqdiag {
Rich Bennett1da30462017-08-24 12:11:36 -040019 DA [label = "Doc Project\nAuthor/Committer", color=lightblue];
20 DR [label = "Doc Gerrit Repo" , color=pink];
21 PR [label = "Other Project\nGerrit Repo", color=pink ];
22 PA [label = "Other Project\nAuthor/Committer", color=lightblue];
Blaisonneau David2963ece2017-11-27 10:07:18 +010023
Rich Bennette4c42512017-09-06 08:07:22 -040024 PA -> DR [label = "Add project repo as\ngit submodule" ];
25 DR -> DA [label = "Review & Plan to\nIntegrate Content with\nTocTree Structure" ];
26 DR <-- DA [label = "Vote +2/Merge" ];
Blaisonneau David2963ece2017-11-27 10:07:18 +010027 PA <-- DR [label = "Merge Notification" ];
Rich Bennette4c42512017-09-06 08:07:22 -040028 PA -> PR [label = "Create in project repo\ntop level directory and index.rst" ];
Rich Bennett358472a2017-08-31 08:05:36 -040029 PR -> DA [label = "Add as Reviewer" ];
30 PR <-- DA [label = "Approve and Integrate" ];
31 PA <-- PR [label = "Merge" ];
Rich Bennett1da30462017-08-24 12:11:36 -040032 }
Blaisonneau David2963ece2017-11-27 10:07:18 +010033
Rich Bennette4c42512017-09-06 08:07:22 -040034Setup project repositories(s)
35-----------------------------
Rich Bennettd504dc82018-05-31 08:40:36 -040036These steps are performed for each project repository that
37provides documentation.
Rich Bennett1da30462017-08-24 12:11:36 -040038
Rich Bennett5baea462017-09-13 03:19:19 -040039First let's set two variables that will be used in the subsequent steps.
Rich Bennettd504dc82018-05-31 08:40:36 -040040Set *reponame* to the project repository you are setting up
41just as it appears in the **Project Name** column of
42the Gerrit projects page.
43Set *lfid* to your Linux Foundation identity that you use to
44login to gerrit or for git clone requests over ssh.
Rich Bennette4c42512017-09-06 08:07:22 -040045
46.. code-block:: bash
47
48 reponame=
49 lfid=
50
Rich Bennettd504dc82018-05-31 08:40:36 -040051The next step is to add a directory in the doc project where your
52project will be included as a submodule and at least one reference
53from the doc project to the documentation index in your repository.
Krzysztof Opasiak6688fd02019-07-09 23:31:00 +020054The following sequence will do this over ssh. Please note that the
55reference to your project in *repolist.rst* should be considered
56temporary and removed when you reference it from more appropriate
57place.
Rich Bennett5baea462017-09-13 03:19:19 -040058
59.. caution::
60
Rich Bennettd504dc82018-05-31 08:40:36 -040061 If your access network restricts ssh, you will need to use equivalent
62 git commands and HTTP Passwords as described `here <http://wiki.onap.org/x/X4AP>`_.
Blaisonneau David2963ece2017-11-27 10:07:18 +010063
Krzysztof Opasiak8b43b972019-05-29 17:29:48 +020064.. caution::
65
66 Don't replace ../ in *git submodule add* with any relative path on
67 your local file system. It refers to the location of your repository
68 on the server.
69
Rich Bennett358472a2017-08-31 08:05:36 -040070.. code-block:: bash
71
Rich Bennette4c42512017-09-06 08:07:22 -040072 git clone ssh://$lfid@gerrit.onap.org:29418/doc
Rich Bennett358472a2017-08-31 08:05:36 -040073 cd doc
74 mkdir -p `dirname docs/submodules/$reponame`
Rich Bennett2360e212017-09-20 08:26:05 -040075 git submodule add ../$reponame docs/submodules/$reponame.git
Rich Bennette4c42512017-09-06 08:07:22 -040076 git submodule init docs/submodules/$reponame.git
77 git submodule update docs/submodules/$reponame.git
Rich Bennett358472a2017-08-31 08:05:36 -040078
Rich Bennette4c42512017-09-06 08:07:22 -040079 echo " $reponame <../submodules/$reponame.git/docs/index>" >> docs/release/repolist.rst
Blaisonneau David2963ece2017-11-27 10:07:18 +010080
Rich Bennett358472a2017-08-31 08:05:36 -040081 git add .
Rich Bennette4c42512017-09-06 08:07:22 -040082 git commit -s
Rich Bennett358472a2017-08-31 08:05:36 -040083 git review
Blaisonneau David2963ece2017-11-27 10:07:18 +010084
Rich Bennett5baea462017-09-13 03:19:19 -040085.. caution::
86 Wait for the above change to be merged before any merge to the
87 project repository that you have just added as a submodule.
Rich Bennettd504dc82018-05-31 08:40:36 -040088 If the project repository added as submodule changes before the
89 doc project merge, git may not automatically update the submodule
90 reference on changes and/or the verify job will fail in the step below.
Rich Bennett358472a2017-08-31 08:05:36 -040091
92
Rich Bennettd504dc82018-05-31 08:40:36 -040093The last step is to create a docs directory in your repository with
94an index.rst file. The following sequence will complete the minimum
95required over ssh. As you have time to convert or add new content you
96can update the index and add files under the docs folder.
Rich Bennett5baea462017-09-13 03:19:19 -040097
98.. hint::
99 If you have additional content, you can include it by editing the
100 index.rst file and/or adding other files before the git commit.
Rich Bennettd504dc82018-05-31 08:40:36 -0400101 See `Templates and Examples`_ below and :ref:`converting-to-rst`
102 for more information.
Blaisonneau David2963ece2017-11-27 10:07:18 +0100103
Rich Bennett1da30462017-08-24 12:11:36 -0400104
105.. code-block:: bash
106
Rich Bennette4c42512017-09-06 08:07:22 -0400107 git clone ssh://$lfid@gerrit.onap.org:29418/$reponame
Rich Bennetta9d6a442017-08-25 02:37:15 -0400108 cd $reponame
Rich Bennett1da30462017-08-24 12:11:36 -0400109 mkdir docs
110 echo ".. This work is licensed under a Creative Commons Attribution 4.0 International License.
111
Rich Bennetta9d6a442017-08-25 02:37:15 -0400112 TODO Add files to toctree and delete this header
113 ------------------------------------------------
Rich Bennett1da30462017-08-24 12:11:36 -0400114 .. toctree::
115 :maxdepth: 1
Blaisonneau David2963ece2017-11-27 10:07:18 +0100116
Rich Bennett1da30462017-08-24 12:11:36 -0400117 " > docs/index.rst
Blaisonneau David2963ece2017-11-27 10:07:18 +0100118
Rich Bennett1da30462017-08-24 12:11:36 -0400119 git add .
Rich Bennette4c42512017-09-06 08:07:22 -0400120 git commit -s
Rich Bennett1da30462017-08-24 12:11:36 -0400121 git review
Blaisonneau David2963ece2017-11-27 10:07:18 +0100122
Rich Bennettac93e0e2017-07-19 01:36:52 -0400123
Rich Bennett1da30462017-08-24 12:11:36 -0400124The diagram below illustrates what is accomplished in the setup steps
Rich Bennetta9d6a442017-08-25 02:37:15 -0400125above from the perspective of a file structure created for a local test,
Rich Bennett358472a2017-08-31 08:05:36 -0400126a jenkins verify job, and/or published release documentation including:
Rich Bennett0c826432017-09-18 17:28:09 -0400127
128- ONAP gerrit project repositories,
Rich Bennettac93e0e2017-07-19 01:36:52 -0400129
Rich Bennettd504dc82018-05-31 08:40:36 -0400130- doc project repository master document index.rst, templates,
131 configuration, and other documents
132
133- submodules directory where other project repositories and
134 directories/files are referenced
135
136- file structure: directories (ellipses), files(boxes)
137
138- references: directory/files (solid edges), git submodule
139 (dotted edges), sphinx toctree (dashed edges)
Rich Bennettac93e0e2017-07-19 01:36:52 -0400140
141.. graphviz::
142
Blaisonneau David2963ece2017-11-27 10:07:18 +0100143
Rich Bennettac93e0e2017-07-19 01:36:52 -0400144 digraph docstructure {
145 size="8,12";
146 node [fontname = "helvetica"];
147 // Align gerrit repos and docs directories
Rich Bennetta9d6a442017-08-25 02:37:15 -0400148 {rank=same doc aaf aai reponame repoelipse vnfsdk vvp}
Rich Bennett1da30462017-08-24 12:11:36 -0400149 {rank=same confpy release templates masterindex submodules otherdocdocumentelipse}
Rich Bennett358472a2017-08-31 08:05:36 -0400150 {rank=same releasedocumentindex releaserepolist}
Rich Bennettac93e0e2017-07-19 01:36:52 -0400151
152 //Illustrate Gerrit Repos and provide URL/Link for complete repo list
153 gerrit [label="gerrit.onap.org/r", href="https://gerrit.onap.org/r/#/admin/projects/" ];
Rich Bennett358472a2017-08-31 08:05:36 -0400154 doc [href="https://gerrit.onap.org/r/gitweb?p=doc.git;a=tree"];
Rich Bennettac93e0e2017-07-19 01:36:52 -0400155 gerrit -> doc;
156 gerrit -> aaf;
157 gerrit -> aai;
Blaisonneau David2963ece2017-11-27 10:07:18 +0100158 gerrit -> reponame;
Rich Bennett1da30462017-08-24 12:11:36 -0400159 gerrit -> repoelipse;
160 repoelipse [label=". . . ."];
Rich Bennettac93e0e2017-07-19 01:36:52 -0400161 gerrit -> vnfsdk;
162 gerrit -> vvp;
163
Rich Bennetta9d6a442017-08-25 02:37:15 -0400164 //Show example of local reponame instance of component info
165 reponame -> reponamedocsdir;
Blaisonneau David2963ece2017-11-27 10:07:18 +0100166 reponamesm -> reponamedocsdir;
Rich Bennetta9d6a442017-08-25 02:37:15 -0400167 reponamedocsdir [label="docs"];
Blaisonneau David2963ece2017-11-27 10:07:18 +0100168 reponamedocsdir -> repnamedocsdirindex;
Rich Bennette4c42512017-09-06 08:07:22 -0400169 repnamedocsdirindex [label="index.rst", shape=box];
Rich Bennettac93e0e2017-07-19 01:36:52 -0400170
Blaisonneau David2963ece2017-11-27 10:07:18 +0100171 //Show detail structure of a portion of doc/docs
Rich Bennettac93e0e2017-07-19 01:36:52 -0400172 doc -> docs;
Blaisonneau David2963ece2017-11-27 10:07:18 +0100173 docs -> confpy;
Rich Bennett1da30462017-08-24 12:11:36 -0400174 confpy [label="conf.py",shape=box];
Blaisonneau David2963ece2017-11-27 10:07:18 +0100175 docs -> masterindex;
Rich Bennett358472a2017-08-31 08:05:36 -0400176 masterindex [label="Master\nindex.rst", shape=box];
Rich Bennettac93e0e2017-07-19 01:36:52 -0400177 docs -> release;
Blaisonneau David2963ece2017-11-27 10:07:18 +0100178 docs -> templates;
179 docs -> otherdocdocumentelipse;
Rich Bennett1da30462017-08-24 12:11:36 -0400180 otherdocdocumentelipse [label="...other\ndocuments"];
Rich Bennettac93e0e2017-07-19 01:36:52 -0400181 docs -> submodules
Blaisonneau David2963ece2017-11-27 10:07:18 +0100182
Rich Bennett1da30462017-08-24 12:11:36 -0400183 masterindex -> releasedocumentindex [style=dashed, label="sphinx\ntoctree\nreference"];
Blaisonneau David2963ece2017-11-27 10:07:18 +0100184
Rich Bennett1da30462017-08-24 12:11:36 -0400185 //Show submodule linkage to docs directory
Blaisonneau David2963ece2017-11-27 10:07:18 +0100186 submodules -> reponamesm [style=dotted,label="git\nsubmodule\nreference"];
Rich Bennette4c42512017-09-06 08:07:22 -0400187 reponamesm [label="reponame.git"];
Rich Bennettac93e0e2017-07-19 01:36:52 -0400188
Rich Bennett1da30462017-08-24 12:11:36 -0400189 //Example Release document index that references component info provided in other project repo
Blaisonneau David2963ece2017-11-27 10:07:18 +0100190 release -> releasedocumentindex;
Rich Bennett1da30462017-08-24 12:11:36 -0400191 releasedocumentindex [label="index.rst", shape=box];
Rich Bennett358472a2017-08-31 08:05:36 -0400192 releasedocumentindex -> releaserepolist [style=dashed, label="sphinx\ntoctree\nreference"];
Blaisonneau David2963ece2017-11-27 10:07:18 +0100193 releaserepolist [label="repolist.rst", shape=box];
Rich Bennett358472a2017-08-31 08:05:36 -0400194 release -> releaserepolist;
Rich Bennette4c42512017-09-06 08:07:22 -0400195 releaserepolist -> repnamedocsdirindex [style=dashed, label="sphinx\ntoctree\nreference"];
Blaisonneau David2963ece2017-11-27 10:07:18 +0100196
Rich Bennettac93e0e2017-07-19 01:36:52 -0400197 }
198
Rich Bennettd504dc82018-05-31 08:40:36 -0400199Branches in the DOC Project
200---------------------------
201
202The DOC project 'master' branch aggregates the 'latest' content
203from all ONAP project repositories contributing documentation into a
204single tree file structure as described in the previous section. This
205branch is continuously integrated and deployed at Read The
206Docs as the 'latest' ONAP Documentation by:
207
208* Jenkins doc-verify-rtd and doc-merge-rtd jobs triggered whenever patches on
209 contributing repositories contain rst files at or below a top level
210 'docs' folder.
211
212* Subscription in the DOC project to changes in submodule repositories.
213 These changes appear in the DOC project as commits with title
214 'Updated git submodules' when a change to a contributing project
215 repository is merged. No DOC project code review occurs, only a
216 submodule repository commit hash is updated to track the head of each
217 contributing master branch.
218
219For each ONAP named release the DOC project creates a branch with the
220release name. The timing of the release branch is determined by
221work needed in the DOC project to prepare the release branch and the
222amount of change unrelated to the release in the master branch.
223For example contributing projects that create named release branches
224early to begin work on the next release and/or contributing projects
225to the master that are not yet part of the named release would result
226in an earlier named release branch to cleanly separate work to stabilize
227a release from other changes in the master branch.
228
229A named release branch is integrated and deployed at Read The Docs
230as the 'named release' by aggregating content from contributing
231project repositories. A contributing project repository can
232choose one of the following for the 'named release' branch:
233
234* Remove the contributing project repository submodule and RST
235 references when not part of the named release.
236
237* Provide a commit hash or tag for the contributing project master
238 branch to be used for the life of the release branch or until a
239 request is submitted to change the commit hash or tag.
240
241* Provide the commit hash for the head of a named release branch
242 created in the contributing project repository. This option
243 may be appropriate if frequent changes are expected over the
244 life of the named release and work the same way as the continuous
245 integration and deployment described for the master branch.
246
247The decision on option for each contributing project repository
248can be made or changed before the final release is approved. The
249amount of change and expected differences between master and a
250named release branch for each repository should drive the choice of
251option and timing.
252
Blaisonneau David2963ece2017-11-27 10:07:18 +0100253About GIT branches
254------------------
255
256GIT is a powerful tool allowing many actions, but without respecting some rules
Rich Bennettd504dc82018-05-31 08:40:36 -0400257the GIT structure can be quickly hard to maintain.
Blaisonneau David2963ece2017-11-27 10:07:18 +0100258
259Here are some conventions about GIT branches:
Rich Bennettd504dc82018-05-31 08:40:36 -0400260
Blaisonneau David2963ece2017-11-27 10:07:18 +0100261 - ALWAYS create a local branch to edit or create any file. This local branch
Rich Bennettd504dc82018-05-31 08:40:36 -0400262 will be considered as a topic in Gerrit and allow contributors to
263 work at the same time on the same project.
264
265 - 1 feature = 1 branch. In the case of documentation, a new chapter
266 or page about a new code feature can be considered as a 'doc feature'
267
268 - 1 bug = 1 branch. In the case of documentation, a correction on an
269 existing sentence can be considered as a 'doc bug'
270
Blaisonneau David2963ece2017-11-27 10:07:18 +0100271 - the master branch is considered as "unstable", containing new features that
272 will converge to a stable situation for the release date.
273
274The day of the release, the repository owner will create a new branch to
275fix the code and documentation. This will represent the 'stable' code of the
276release. In this context:
Rich Bennett7e34ab32018-04-18 11:03:25 -0400277
Blaisonneau David2963ece2017-11-27 10:07:18 +0100278 - NEVER push a new feature on a stable branch
Rich Bennett7e34ab32018-04-18 11:03:25 -0400279
Rich Bennettd504dc82018-05-31 08:40:36 -0400280 - Only bug correction are authorized on a stable branch using
281 cherry pick method
Blaisonneau David2963ece2017-11-27 10:07:18 +0100282
283.. image:: git_branches.png
284
Rich Bennetta9d6a442017-08-25 02:37:15 -0400285Creating Restructured Text
286==========================
Rich Bennettac93e0e2017-07-19 01:36:52 -0400287
Rich Bennett5baea462017-09-13 03:19:19 -0400288Templates and Examples
289----------------------
Rich Bennett7134cba2017-10-10 07:39:06 -0400290Templates are available that capture the kinds of information
Blaisonneau David2963ece2017-11-27 10:07:18 +0100291useful for different types of projects and provide some examples of
Rich Bennettd504dc82018-05-31 08:40:36 -0400292restructured text. We organize templates in the following way to:
Rich Bennett7134cba2017-10-10 07:39:06 -0400293
Rich Bennettd504dc82018-05-31 08:40:36 -0400294 - help authors understand relationships between documents
295
296 - keep the user audience context in mind when writing and
297
298 - tailor sections for different kinds of projects.
299
300
301**Sections** Represent a certain type of content. A section
302is **provided** in an project repository, to describe something about
303the characteristics, use, capability, etc. of things in that repository.
304A section may also be **referenced** from other sections and in
305other repositories. For example, an API specification provided in a project
306repository might be referenced to in a Platform API Reference Guide.
Rich Bennett7134cba2017-10-10 07:39:06 -0400307The notes in the beginning of each section template provide
Rich Bennettd504dc82018-05-31 08:40:36 -0400308additional detail about what is typically covered and where
309there may be references to the section.
Rich Bennett7134cba2017-10-10 07:39:06 -0400310
Rich Bennettd504dc82018-05-31 08:40:36 -0400311**Collections** Are a set of sections that are typically provided
312for a particular type of project, repository, guide, reference manual, etc.
313For example, a collection for a platform component, an SDK, etc.
Rich Bennett7134cba2017-10-10 07:39:06 -0400314
Rich Bennettd504dc82018-05-31 08:40:36 -0400315You can: browse the template *collections* and *sections* below;
316show source to look at the Restructured Text and Sphinx directives used;
317copy the source either from a browser window or by downloading the
318file in raw form from
Rich Bennett7134cba2017-10-10 07:39:06 -0400319the `gerrit doc repository <https://gerrit.onap.org/r/gitweb?p=doc.git;a=tree;f=docs/templates;/>`_ and
320then add them to your repository docs folder and index.rst.
321
322
323Sections
324++++++++
Rich Bennett5baea462017-09-13 03:19:19 -0400325
326.. toctree::
327 :maxdepth: 1
328 :glob:
329
Rich Bennett7134cba2017-10-10 07:39:06 -0400330 ../../../templates/sections/*
331
332
333Collections
334+++++++++++
335
336.. toctree::
337 :maxdepth: 1
338 :glob:
339
340 ../../../templates/collections/*
341
342
Rich Bennett5baea462017-09-13 03:19:19 -0400343
Blaisonneau David2963ece2017-11-27 10:07:18 +0100344In addition to these simple templates and examples
Rich Bennett5baea462017-09-13 03:19:19 -0400345there are many open source projects (e.g. Open Daylight, Open Stack)
Rich Bennettd504dc82018-05-31 08:40:36 -0400346that are using Sphinx and Readthedocs where you may find examples
347to start with. Working with project teams we will continue to enhance
348templates here and capture frequently asked questions on the developer
349wiki question topic `documentation <https://wiki.onap.org/questions/topics/16384055/documentation>`_.
Rich Bennett5baea462017-09-13 03:19:19 -0400350
Rich Bennettd504dc82018-05-31 08:40:36 -0400351Each project should:
352
353 - decide what is relevant content
354
355 - determine the best way to create/maintain it in the CI/CD process and
356
357 - work with the documentation team to reference content from the
358 master index and guides.
359
360Consider options including filling in a template, identifying existing
361content that can be used as is or easily converted, and use of Sphinx
362directives/extensions to automatically generate restructured text
363from other source you already have.
Rich Bennettac93e0e2017-07-19 01:36:52 -0400364
Rich Bennetta9d6a442017-08-25 02:37:15 -0400365Links and References
Rich Bennett5baea462017-09-13 03:19:19 -0400366--------------------
Rich Bennettac93e0e2017-07-19 01:36:52 -0400367It's pretty common to want to reference another location in the
368ONAP documentation and it's pretty easy to do with
369reStructuredText. This is a quick primer, more information is in the
370`Sphinx section on Cross-referencing arbitrary locations
371<http://www.sphinx-doc.org/en/stable/markup/inline.html#ref-role>`_.
372
373Within a single document, you can reference another section simply by::
374
375 This is a reference to `The title of a section`_
376
377Assuming that somewhere else in the same file there a is a section
378title something like::
379
380 The title of a section
381 ^^^^^^^^^^^^^^^^^^^^^^
382
383It's typically better to use ``:ref:`` syntax and labels to provide
384links as they work across files and are resilient to sections being
385renamed. First, you need to create a label something like::
386
387 .. _a-label:
388
389 The title of a section
390 ^^^^^^^^^^^^^^^^^^^^^^
391
392.. note:: The underscore (_) before the label is required.
393
394Then you can reference the section anywhere by simply doing::
395
396 This is a reference to :ref:`a-label`
397
398or::
399
400 This is a reference to :ref:`a section I really liked <a-label>`
401
402.. note:: When using ``:ref:``-style links, you don't need a trailing
403 underscore (_).
404
405Because the labels have to be unique, it usually makes sense to prefix
406the labels with the project name to help share the label space, e.g.,
407``sfc-user-guide`` instead of just ``user-guide``.
408
Rich Bennetta9d6a442017-08-25 02:37:15 -0400409Testing
410=======
Rich Bennettac93e0e2017-07-19 01:36:52 -0400411
Rich Bennetta9d6a442017-08-25 02:37:15 -0400412One RST File
413------------
Rich Bennettac93e0e2017-07-19 01:36:52 -0400414It is recommended that all rst content is validated by `doc8 <https://pypi.python.org/pypi/doc8>`_ standards.
415To validate your rst files using doc8, install doc8.
416
417.. code-block:: bash
418
419 sudo pip install doc8
420
421doc8 can now be used to check the rst files. Execute as,
422
423.. code-block:: bash
424
425 doc8 --ignore D000,D001 <file>
426
427
Rich Bennettac93e0e2017-07-19 01:36:52 -0400428
Rich Bennetta9d6a442017-08-25 02:37:15 -0400429One Project
430-----------
Rich Bennettac93e0e2017-07-19 01:36:52 -0400431To test how the documentation renders in HTML, follow these steps:
432
Pawel Wieczorek1a3294f2019-07-10 16:20:22 +0200433Install `virtual environment <https://pypi.org/project/virtualenv>`_ & create one.
Rich Bennettac93e0e2017-07-19 01:36:52 -0400434
435.. code-block:: bash
436
437 sudo pip install virtualenv
Pawel Wieczorek1a3294f2019-07-10 16:20:22 +0200438 virtualenv onap_docs
439
440Activate `onap_docs` virtual environment.
441
442.. code-block:: bash
443
444 source onap_docs/bin/activate
445
446.. note:: Virtual environment activation has to be performed before attempting to build documentation.
447 Otherwise, tools necessary for the process might not be available.
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200448
449Download a project repository.
450
451.. code-block:: bash
452
Pawel Wieczorek1a3294f2019-07-10 16:20:22 +0200453 git clone http://gerrit.onap.org/r/<project>
Rich Bennettac93e0e2017-07-19 01:36:52 -0400454
455Download the doc repository.
456
457.. code-block:: bash
458
459 git clone http://gerrit.onap.org/r/doc
460
461Change directory to doc & install requirements.
462
463.. code-block:: bash
464
465 cd doc
Pawel Wieczorek1a3294f2019-07-10 16:20:22 +0200466 pip install -r etc/requirements.txt
Rich Bennettac93e0e2017-07-19 01:36:52 -0400467
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200468Copy the conf.py file to your project folder where RST files have been kept:
Rich Bennettac93e0e2017-07-19 01:36:52 -0400469
470.. code-block:: bash
471
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200472 cp docs/conf.py <path-to-project-folder>/<folder where are rst files>
Rich Bennettac93e0e2017-07-19 01:36:52 -0400473
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200474Copy the static files to the project folder where RST files have been kept:
Rich Bennettac93e0e2017-07-19 01:36:52 -0400475
476.. code-block:: bash
477
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200478 cp -r docs/_static/ <path-to-project-folder>/<folder where are rst files>
Rich Bennettac93e0e2017-07-19 01:36:52 -0400479
480Build the documentation from within your project folder:
481
482.. code-block:: bash
483
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200484 sphinx-build -b html <path-to-project-folder>/<folder where are rst files> <path-to-output-folder>
Rich Bennettac93e0e2017-07-19 01:36:52 -0400485
486Your documentation shall be built as HTML inside the
487specified output folder directory.
488
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200489You can use your Web Browser to open
490and check resulting html pages in the output folder.
491
Pawel Wieczorek1a3294f2019-07-10 16:20:22 +0200492.. note:: Be sure to remove the `conf.py`, the static/ files and the output folder from the `<project>/docs/`. This is for testing only. Only commit the rst files and related content.
Rich Bennettac93e0e2017-07-19 01:36:52 -0400493
jsseidel80666192017-09-19 13:29:23 -0400494.. _building-all-documentation:
Rich Bennettac93e0e2017-07-19 01:36:52 -0400495
Rich Bennetta9d6a442017-08-25 02:37:15 -0400496All Documentation
497-----------------
Rich Bennettd504dc82018-05-31 08:40:36 -0400498To build the all documentation under doc/, follow these steps:
Rich Bennettac93e0e2017-07-19 01:36:52 -0400499
Pawel Wieczorek6e823832019-07-10 16:31:27 +0200500Install `tox <https://pypi.org/project/tox>`_.
Rich Bennettac93e0e2017-07-19 01:36:52 -0400501
502.. code-block:: bash
503
Pawel Wieczorek6e823832019-07-10 16:31:27 +0200504 sudo pip install tox
Rich Bennetta9d6a442017-08-25 02:37:15 -0400505
506Download the DOC repository.
507
508.. code-block:: bash
509
510 git clone http://gerrit.onap.org/r/doc
511
Rich Bennett9c3af502018-04-26 09:30:57 -0400512Build documentation using tox local environment & then open using any browser.
Rich Bennetta9d6a442017-08-25 02:37:15 -0400513
514.. code-block:: bash
515
516 cd doc
Cédric Ollivier268209c2017-11-10 11:31:53 +0100517 tox -elocal
Rich Bennetta9d6a442017-08-25 02:37:15 -0400518 firefox docs/_build/html/index.html
519
Cédric Ollivier268209c2017-11-10 11:31:53 +0100520.. note:: Make sure to run `tox -elocal` and not just `tox`.
Rich Bennett50d0d882019-03-08 17:03:58 -0500521 This updates all submodule repositories that are integrated
522 by the doc project.
Rich Bennett9c3af502018-04-26 09:30:57 -0400523
Rich Bennettd504dc82018-05-31 08:40:36 -0400524There are additional tox environment options for checking External
Rene_Robertbf4ab4e2019-07-01 18:12:40 +0200525URLs and Spelling. Use the tox environment options below and then
Rich Bennett50d0d882019-03-08 17:03:58 -0500526look at the output with the Linux `more` or similar command
527scan for output that applies to the files you are validating.
Rich Bennett9c3af502018-04-26 09:30:57 -0400528
529.. code-block:: bash
530
531 tox -elinkcheck
532 more < docs/_build/linkcheck/output.txt
533
534 tox -espellcheck
535 more < docs/_build/spellcheck/output.txt