Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 1 | .. 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 Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 4 | |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 5 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 6 | Setting Up |
| 7 | ========== |
jsseidel | da2324a | 2017-09-15 10:43:14 -0400 | [diff] [blame] | 8 | |
Andrea Visnyei | 8f67819 | 2020-05-29 12:48:12 +0200 | [diff] [blame] | 9 | ONAP documentation is stored in git repositories, changes are managed |
| 10 | with gerrit reviews, and published documents generated when there is a |
| 11 | change in any source used to build the documentation. |
| 12 | |
| 13 | Authors create source for documents in reStructured Text (RST) that is |
| 14 | rendered to HTML and published on Readthedocs.io. |
| 15 | The developer Wiki or other web sites can reference these rendered |
| 16 | documents directly allowing projects to easily maintain current release |
| 17 | documentation. |
| 18 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 19 | Some initial set up is required to connect a project with |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 20 | the master document structure and enable automated publishing of |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 21 | changes as summarized in the following diagram and description below |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 22 | below. |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 23 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 24 | .. seqdiag:: |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 25 | :height: 700 |
| 26 | :width: 1000 |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 27 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 28 | seqdiag { |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 29 | DA [label = "Doc Project\nAuthor/Committer", color=lightblue]; |
| 30 | DR [label = "Doc Gerrit Repo" , color=pink]; |
| 31 | PR [label = "Other Project\nGerrit Repo", color=pink ]; |
| 32 | PA [label = "Other Project\nAuthor/Committer", color=lightblue]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 33 | |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 34 | PA -> DR [label = "Add project repo as\ngit submodule" ]; |
| 35 | DR -> DA [label = "Review & Plan to\nIntegrate Content with\nTocTree Structure" ]; |
| 36 | DR <-- DA [label = "Vote +2/Merge" ]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 37 | PA <-- DR [label = "Merge Notification" ]; |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 38 | PA -> PR [label = "Create in project repo\ntop level directory and index.rst" ]; |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 39 | PR -> DA [label = "Add as Reviewer" ]; |
| 40 | PR <-- DA [label = "Approve and Integrate" ]; |
| 41 | PA <-- PR [label = "Merge" ]; |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 42 | } |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 43 | |
Andrea Visnyei | 8f67819 | 2020-05-29 12:48:12 +0200 | [diff] [blame] | 44 | Setup project repositories |
| 45 | -------------------------- |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 46 | These steps are performed for each project repository that |
| 47 | provides documentation. |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 48 | |
Andrea Visnyei | 8f67819 | 2020-05-29 12:48:12 +0200 | [diff] [blame] | 49 | 1. Set two variables that will be used in the subsequent steps. |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 50 | Set *reponame* to the project repository you are setting up |
| 51 | just as it appears in the **Project Name** column of |
| 52 | the Gerrit projects page. |
| 53 | Set *lfid* to your Linux Foundation identity that you use to |
| 54 | login to gerrit or for git clone requests over ssh. |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 55 | |
| 56 | .. code-block:: bash |
| 57 | |
| 58 | reponame= |
| 59 | lfid= |
| 60 | |
Andrea Visnyei | 8f67819 | 2020-05-29 12:48:12 +0200 | [diff] [blame] | 61 | 2. Add a directory in the doc project where your |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 62 | project will be included as a submodule and at least one reference |
| 63 | from the doc project to the documentation index in your repository. |
Krzysztof Opasiak | 6688fd0 | 2019-07-09 23:31:00 +0200 | [diff] [blame] | 64 | The following sequence will do this over ssh. Please note that the |
| 65 | reference to your project in *repolist.rst* should be considered |
| 66 | temporary and removed when you reference it from more appropriate |
| 67 | place. |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 68 | |
| 69 | .. caution:: |
| 70 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 71 | If your access network restricts ssh, you will need to use equivalent |
| 72 | git commands and HTTP Passwords as described `here <http://wiki.onap.org/x/X4AP>`_. |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 73 | |
Krzysztof Opasiak | 8b43b97 | 2019-05-29 17:29:48 +0200 | [diff] [blame] | 74 | .. caution:: |
| 75 | |
| 76 | Don't replace ../ in *git submodule add* with any relative path on |
| 77 | your local file system. It refers to the location of your repository |
| 78 | on the server. |
| 79 | |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 80 | .. code-block:: bash |
| 81 | |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 82 | git clone ssh://$lfid@gerrit.onap.org:29418/doc |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 83 | cd doc |
| 84 | mkdir -p `dirname docs/submodules/$reponame` |
Rich Bennett | 2360e21 | 2017-09-20 08:26:05 -0400 | [diff] [blame] | 85 | git submodule add ../$reponame docs/submodules/$reponame.git |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 86 | git submodule init docs/submodules/$reponame.git |
| 87 | git submodule update docs/submodules/$reponame.git |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 88 | |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 89 | echo " $reponame <../submodules/$reponame.git/docs/index>" >> docs/release/repolist.rst |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 90 | |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 91 | git add . |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 92 | git commit -s |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 93 | git review |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 94 | |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 95 | .. caution:: |
| 96 | Wait for the above change to be merged before any merge to the |
| 97 | project repository that you have just added as a submodule. |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 98 | If the project repository added as submodule changes before the |
| 99 | doc project merge, git may not automatically update the submodule |
| 100 | reference on changes and/or the verify job will fail in the step below. |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 101 | |
| 102 | |
Andrea Visnyei | 8f67819 | 2020-05-29 12:48:12 +0200 | [diff] [blame] | 103 | 3. Create a docs directory in your repository with |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 104 | an index.rst file. The following sequence will complete the minimum |
| 105 | required over ssh. As you have time to convert or add new content you |
| 106 | can update the index and add files under the docs folder. |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 107 | |
| 108 | .. hint:: |
| 109 | If you have additional content, you can include it by editing the |
| 110 | index.rst file and/or adding other files before the git commit. |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 111 | See `Templates and Examples`_ below and :ref:`converting-to-rst` |
| 112 | for more information. |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 113 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 114 | |
| 115 | .. code-block:: bash |
| 116 | |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 117 | git clone ssh://$lfid@gerrit.onap.org:29418/$reponame |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 118 | cd $reponame |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 119 | mkdir docs |
| 120 | echo ".. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 121 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 122 | TODO Add files to toctree and delete this header |
| 123 | ------------------------------------------------ |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 124 | .. toctree:: |
| 125 | :maxdepth: 1 |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 126 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 127 | " > docs/index.rst |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 128 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 129 | git add . |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 130 | git commit -s |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 131 | git review |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 132 | |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 133 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 134 | The diagram below illustrates what is accomplished in the setup steps |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 135 | above from the perspective of a file structure created for a local test, |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 136 | a jenkins verify job, and/or published release documentation including: |
Rich Bennett | 0c82643 | 2017-09-18 17:28:09 -0400 | [diff] [blame] | 137 | |
| 138 | - ONAP gerrit project repositories, |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 139 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 140 | - doc project repository master document index.rst, templates, |
| 141 | configuration, and other documents |
| 142 | |
| 143 | - submodules directory where other project repositories and |
| 144 | directories/files are referenced |
| 145 | |
| 146 | - file structure: directories (ellipses), files(boxes) |
| 147 | |
| 148 | - references: directory/files (solid edges), git submodule |
| 149 | (dotted edges), sphinx toctree (dashed edges) |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 150 | |
| 151 | .. graphviz:: |
| 152 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 153 | |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 154 | digraph docstructure { |
| 155 | size="8,12"; |
| 156 | node [fontname = "helvetica"]; |
| 157 | // Align gerrit repos and docs directories |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 158 | {rank=same doc aaf aai reponame repoelipse vnfsdk vvp} |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 159 | {rank=same confpy release templates masterindex submodules otherdocdocumentelipse} |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 160 | {rank=same releasedocumentindex releaserepolist} |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 161 | |
| 162 | //Illustrate Gerrit Repos and provide URL/Link for complete repo list |
| 163 | gerrit [label="gerrit.onap.org/r", href="https://gerrit.onap.org/r/#/admin/projects/" ]; |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 164 | doc [href="https://gerrit.onap.org/r/gitweb?p=doc.git;a=tree"]; |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 165 | gerrit -> doc; |
| 166 | gerrit -> aaf; |
| 167 | gerrit -> aai; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 168 | gerrit -> reponame; |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 169 | gerrit -> repoelipse; |
| 170 | repoelipse [label=". . . ."]; |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 171 | gerrit -> vnfsdk; |
| 172 | gerrit -> vvp; |
| 173 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 174 | //Show example of local reponame instance of component info |
| 175 | reponame -> reponamedocsdir; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 176 | reponamesm -> reponamedocsdir; |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 177 | reponamedocsdir [label="docs"]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 178 | reponamedocsdir -> repnamedocsdirindex; |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 179 | repnamedocsdirindex [label="index.rst", shape=box]; |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 180 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 181 | //Show detail structure of a portion of doc/docs |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 182 | doc -> docs; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 183 | docs -> confpy; |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 184 | confpy [label="conf.py",shape=box]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 185 | docs -> masterindex; |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 186 | masterindex [label="Master\nindex.rst", shape=box]; |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 187 | docs -> release; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 188 | docs -> templates; |
| 189 | docs -> otherdocdocumentelipse; |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 190 | otherdocdocumentelipse [label="...other\ndocuments"]; |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 191 | docs -> submodules |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 192 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 193 | masterindex -> releasedocumentindex [style=dashed, label="sphinx\ntoctree\nreference"]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 194 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 195 | //Show submodule linkage to docs directory |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 196 | submodules -> reponamesm [style=dotted,label="git\nsubmodule\nreference"]; |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 197 | reponamesm [label="reponame.git"]; |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 198 | |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 199 | //Example Release document index that references component info provided in other project repo |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 200 | release -> releasedocumentindex; |
Rich Bennett | 1da3046 | 2017-08-24 12:11:36 -0400 | [diff] [blame] | 201 | releasedocumentindex [label="index.rst", shape=box]; |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 202 | releasedocumentindex -> releaserepolist [style=dashed, label="sphinx\ntoctree\nreference"]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 203 | releaserepolist [label="repolist.rst", shape=box]; |
Rich Bennett | 358472a | 2017-08-31 08:05:36 -0400 | [diff] [blame] | 204 | release -> releaserepolist; |
Rich Bennett | e4c4251 | 2017-09-06 08:07:22 -0400 | [diff] [blame] | 205 | releaserepolist -> repnamedocsdirindex [style=dashed, label="sphinx\ntoctree\nreference"]; |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 206 | |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 207 | } |
| 208 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 209 | Branches in the DOC Project |
| 210 | --------------------------- |
| 211 | |
| 212 | The DOC project 'master' branch aggregates the 'latest' content |
| 213 | from all ONAP project repositories contributing documentation into a |
| 214 | single tree file structure as described in the previous section. This |
| 215 | branch is continuously integrated and deployed at Read The |
| 216 | Docs as the 'latest' ONAP Documentation by: |
| 217 | |
| 218 | * Jenkins doc-verify-rtd and doc-merge-rtd jobs triggered whenever patches on |
| 219 | contributing repositories contain rst files at or below a top level |
| 220 | 'docs' folder. |
| 221 | |
| 222 | * Subscription in the DOC project to changes in submodule repositories. |
| 223 | These changes appear in the DOC project as commits with title |
| 224 | 'Updated git submodules' when a change to a contributing project |
| 225 | repository is merged. No DOC project code review occurs, only a |
| 226 | submodule repository commit hash is updated to track the head of each |
| 227 | contributing master branch. |
| 228 | |
| 229 | For each ONAP named release the DOC project creates a branch with the |
| 230 | release name. The timing of the release branch is determined by |
| 231 | work needed in the DOC project to prepare the release branch and the |
| 232 | amount of change unrelated to the release in the master branch. |
| 233 | For example contributing projects that create named release branches |
| 234 | early to begin work on the next release and/or contributing projects |
| 235 | to the master that are not yet part of the named release would result |
| 236 | in an earlier named release branch to cleanly separate work to stabilize |
| 237 | a release from other changes in the master branch. |
| 238 | |
| 239 | A named release branch is integrated and deployed at Read The Docs |
| 240 | as the 'named release' by aggregating content from contributing |
| 241 | project repositories. A contributing project repository can |
| 242 | choose one of the following for the 'named release' branch: |
| 243 | |
| 244 | * Remove the contributing project repository submodule and RST |
| 245 | references when not part of the named release. |
| 246 | |
| 247 | * Provide a commit hash or tag for the contributing project master |
| 248 | branch to be used for the life of the release branch or until a |
| 249 | request is submitted to change the commit hash or tag. |
| 250 | |
| 251 | * Provide the commit hash for the head of a named release branch |
| 252 | created in the contributing project repository. This option |
| 253 | may be appropriate if frequent changes are expected over the |
| 254 | life of the named release and work the same way as the continuous |
| 255 | integration and deployment described for the master branch. |
| 256 | |
| 257 | The decision on option for each contributing project repository |
| 258 | can be made or changed before the final release is approved. The |
| 259 | amount of change and expected differences between master and a |
| 260 | named release branch for each repository should drive the choice of |
| 261 | option and timing. |
| 262 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 263 | About GIT branches |
| 264 | ------------------ |
| 265 | |
| 266 | GIT is a powerful tool allowing many actions, but without respecting some rules |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 267 | the GIT structure can be quickly hard to maintain. |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 268 | |
| 269 | Here are some conventions about GIT branches: |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 270 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 271 | - ALWAYS create a local branch to edit or create any file. This local branch |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 272 | will be considered as a topic in Gerrit and allow contributors to |
| 273 | work at the same time on the same project. |
| 274 | |
| 275 | - 1 feature = 1 branch. In the case of documentation, a new chapter |
| 276 | or page about a new code feature can be considered as a 'doc feature' |
| 277 | |
| 278 | - 1 bug = 1 branch. In the case of documentation, a correction on an |
| 279 | existing sentence can be considered as a 'doc bug' |
| 280 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 281 | - the master branch is considered as "unstable", containing new features that |
| 282 | will converge to a stable situation for the release date. |
| 283 | |
| 284 | The day of the release, the repository owner will create a new branch to |
| 285 | fix the code and documentation. This will represent the 'stable' code of the |
| 286 | release. In this context: |
Rich Bennett | 7e34ab3 | 2018-04-18 11:03:25 -0400 | [diff] [blame] | 287 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 288 | - NEVER push a new feature on a stable branch |
Rich Bennett | 7e34ab3 | 2018-04-18 11:03:25 -0400 | [diff] [blame] | 289 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 290 | - Only bug correction are authorized on a stable branch using |
| 291 | cherry pick method |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 292 | |
| 293 | .. image:: git_branches.png |
| 294 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 295 | Creating Restructured Text |
| 296 | ========================== |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 297 | |
Andrea Visnyei | a2eb2e2 | 2020-09-25 12:23:47 +0200 | [diff] [blame^] | 298 | ReStructuredText markup conventions |
| 299 | ----------------------------------- |
| 300 | For detailed information on ReStructuredText and how to best use the format, |
| 301 | see: |
| 302 | |
| 303 | - `ReStructured Text Primer <http://docutils.sourceforge.net/docs/user/rst/quickstart.html>`_ |
| 304 | - `ReStructured Text Quick Reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ |
| 305 | |
| 306 | |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 307 | Templates and Examples |
| 308 | ---------------------- |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 309 | Templates are available that capture the kinds of information |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 310 | useful for different types of projects and provide some examples of |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 311 | restructured text. We organize templates in the following way to: |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 312 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 313 | - help authors understand relationships between documents |
| 314 | |
| 315 | - keep the user audience context in mind when writing and |
| 316 | |
| 317 | - tailor sections for different kinds of projects. |
| 318 | |
| 319 | |
| 320 | **Sections** Represent a certain type of content. A section |
| 321 | is **provided** in an project repository, to describe something about |
| 322 | the characteristics, use, capability, etc. of things in that repository. |
| 323 | A section may also be **referenced** from other sections and in |
| 324 | other repositories. For example, an API specification provided in a project |
| 325 | repository might be referenced to in a Platform API Reference Guide. |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 326 | The notes in the beginning of each section template provide |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 327 | additional detail about what is typically covered and where |
| 328 | there may be references to the section. |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 329 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 330 | **Collections** Are a set of sections that are typically provided |
| 331 | for a particular type of project, repository, guide, reference manual, etc. |
| 332 | For example, a collection for a platform component, an SDK, etc. |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 333 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 334 | You can: browse the template *collections* and *sections* below; |
| 335 | show source to look at the Restructured Text and Sphinx directives used; |
| 336 | copy the source either from a browser window or by downloading the |
| 337 | file in raw form from |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 338 | the `gerrit doc repository <https://gerrit.onap.org/r/gitweb?p=doc.git;a=tree;f=docs/templates;/>`_ and |
| 339 | then add them to your repository docs folder and index.rst. |
| 340 | |
| 341 | |
| 342 | Sections |
| 343 | ++++++++ |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 344 | |
| 345 | .. toctree:: |
| 346 | :maxdepth: 1 |
| 347 | :glob: |
| 348 | |
Rich Bennett | 7134cba | 2017-10-10 07:39:06 -0400 | [diff] [blame] | 349 | ../../../templates/sections/* |
| 350 | |
| 351 | |
| 352 | Collections |
| 353 | +++++++++++ |
| 354 | |
| 355 | .. toctree:: |
| 356 | :maxdepth: 1 |
| 357 | :glob: |
| 358 | |
| 359 | ../../../templates/collections/* |
| 360 | |
| 361 | |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 362 | |
Blaisonneau David | 2963ece | 2017-11-27 10:07:18 +0100 | [diff] [blame] | 363 | In addition to these simple templates and examples |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 364 | there are many open source projects (e.g. Open Daylight, Open Stack) |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 365 | that are using Sphinx and Readthedocs where you may find examples |
| 366 | to start with. Working with project teams we will continue to enhance |
| 367 | templates here and capture frequently asked questions on the developer |
| 368 | wiki question topic `documentation <https://wiki.onap.org/questions/topics/16384055/documentation>`_. |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 369 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 370 | Each project should: |
| 371 | |
| 372 | - decide what is relevant content |
| 373 | |
| 374 | - determine the best way to create/maintain it in the CI/CD process and |
| 375 | |
| 376 | - work with the documentation team to reference content from the |
| 377 | master index and guides. |
| 378 | |
| 379 | Consider options including filling in a template, identifying existing |
| 380 | content that can be used as is or easily converted, and use of Sphinx |
| 381 | directives/extensions to automatically generate restructured text |
| 382 | from other source you already have. |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 383 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 384 | Links and References |
Rich Bennett | 5baea46 | 2017-09-13 03:19:19 -0400 | [diff] [blame] | 385 | -------------------- |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 386 | It's pretty common to want to reference another location in the |
| 387 | ONAP documentation and it's pretty easy to do with |
| 388 | reStructuredText. This is a quick primer, more information is in the |
| 389 | `Sphinx section on Cross-referencing arbitrary locations |
Aric Gardner | 6ceaa84 | 2020-04-10 14:00:17 -0400 | [diff] [blame] | 390 | <http://www.sphinx-doc.org/en/stable/markup/inline.html>`_. |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 391 | |
| 392 | Within a single document, you can reference another section simply by:: |
| 393 | |
| 394 | This is a reference to `The title of a section`_ |
| 395 | |
| 396 | Assuming that somewhere else in the same file there a is a section |
| 397 | title something like:: |
| 398 | |
| 399 | The title of a section |
| 400 | ^^^^^^^^^^^^^^^^^^^^^^ |
| 401 | |
| 402 | It's typically better to use ``:ref:`` syntax and labels to provide |
| 403 | links as they work across files and are resilient to sections being |
| 404 | renamed. First, you need to create a label something like:: |
| 405 | |
| 406 | .. _a-label: |
| 407 | |
| 408 | The title of a section |
| 409 | ^^^^^^^^^^^^^^^^^^^^^^ |
| 410 | |
| 411 | .. note:: The underscore (_) before the label is required. |
| 412 | |
| 413 | Then you can reference the section anywhere by simply doing:: |
| 414 | |
| 415 | This is a reference to :ref:`a-label` |
| 416 | |
| 417 | or:: |
| 418 | |
| 419 | This is a reference to :ref:`a section I really liked <a-label>` |
| 420 | |
| 421 | .. note:: When using ``:ref:``-style links, you don't need a trailing |
| 422 | underscore (_). |
| 423 | |
| 424 | Because the labels have to be unique, it usually makes sense to prefix |
| 425 | the labels with the project name to help share the label space, e.g., |
| 426 | ``sfc-user-guide`` instead of just ``user-guide``. |
| 427 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 428 | Testing |
| 429 | ======= |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 430 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 431 | One RST File |
| 432 | ------------ |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 433 | It is recommended that all rst content is validated by `doc8 <https://pypi.python.org/pypi/doc8>`_ standards. |
| 434 | To validate your rst files using doc8, install doc8. |
| 435 | |
| 436 | .. code-block:: bash |
| 437 | |
| 438 | sudo pip install doc8 |
| 439 | |
| 440 | doc8 can now be used to check the rst files. Execute as, |
| 441 | |
| 442 | .. code-block:: bash |
| 443 | |
| 444 | doc8 --ignore D000,D001 <file> |
| 445 | |
| 446 | |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 447 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 448 | One Project |
| 449 | ----------- |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 450 | To test how the documentation renders in HTML, follow these steps: |
| 451 | |
Pawel Wieczorek | 1a3294f | 2019-07-10 16:20:22 +0200 | [diff] [blame] | 452 | Install `virtual environment <https://pypi.org/project/virtualenv>`_ & create one. |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 453 | |
| 454 | .. code-block:: bash |
| 455 | |
| 456 | sudo pip install virtualenv |
Pawel Wieczorek | 1a3294f | 2019-07-10 16:20:22 +0200 | [diff] [blame] | 457 | virtualenv onap_docs |
| 458 | |
| 459 | Activate `onap_docs` virtual environment. |
| 460 | |
| 461 | .. code-block:: bash |
| 462 | |
| 463 | source onap_docs/bin/activate |
| 464 | |
| 465 | .. note:: Virtual environment activation has to be performed before attempting to build documentation. |
| 466 | Otherwise, tools necessary for the process might not be available. |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 467 | |
| 468 | Download a project repository. |
| 469 | |
| 470 | .. code-block:: bash |
| 471 | |
Pawel Wieczorek | 1a3294f | 2019-07-10 16:20:22 +0200 | [diff] [blame] | 472 | git clone http://gerrit.onap.org/r/<project> |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 473 | |
| 474 | Download the doc repository. |
| 475 | |
| 476 | .. code-block:: bash |
| 477 | |
| 478 | git clone http://gerrit.onap.org/r/doc |
| 479 | |
| 480 | Change directory to doc & install requirements. |
| 481 | |
| 482 | .. code-block:: bash |
| 483 | |
| 484 | cd doc |
Pawel Wieczorek | 1a3294f | 2019-07-10 16:20:22 +0200 | [diff] [blame] | 485 | pip install -r etc/requirements.txt |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 486 | |
JakobKrieg | 0976715 | 2020-08-06 09:23:22 +0200 | [diff] [blame] | 487 | .. warning:: |
| 488 | |
Andrea Visnyei | a2eb2e2 | 2020-09-25 12:23:47 +0200 | [diff] [blame^] | 489 | Just follow the next step (copying conf.py from Doc project to your project) |
| 490 | if that is your intention, otherwise skip it. Currently all projects should already have a conf.py file. |
JakobKrieg | 0976715 | 2020-08-06 09:23:22 +0200 | [diff] [blame] | 491 | Through the next step, this file and potential extensions in your project get overriden. |
| 492 | |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 493 | Copy the conf.py file to your project folder where RST files have been kept: |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 494 | |
| 495 | .. code-block:: bash |
| 496 | |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 497 | cp docs/conf.py <path-to-project-folder>/<folder where are rst files> |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 498 | |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 499 | Copy the static files to the project folder where RST files have been kept: |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 500 | |
| 501 | .. code-block:: bash |
| 502 | |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 503 | cp -r docs/_static/ <path-to-project-folder>/<folder where are rst files> |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 504 | |
| 505 | Build the documentation from within your project folder: |
| 506 | |
| 507 | .. code-block:: bash |
| 508 | |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 509 | sphinx-build -b html <path-to-project-folder>/<folder where are rst files> <path-to-output-folder> |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 510 | |
| 511 | Your documentation shall be built as HTML inside the |
| 512 | specified output folder directory. |
| 513 | |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 514 | You can use your Web Browser to open |
| 515 | and check resulting html pages in the output folder. |
| 516 | |
Pawel Wieczorek | 1a3294f | 2019-07-10 16:20:22 +0200 | [diff] [blame] | 517 | .. 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 Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 518 | |
jsseidel | 8066619 | 2017-09-19 13:29:23 -0400 | [diff] [blame] | 519 | .. _building-all-documentation: |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 520 | |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 521 | All Documentation |
| 522 | ----------------- |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 523 | To build the all documentation under doc/, follow these steps: |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 524 | |
Pawel Wieczorek | 6e82383 | 2019-07-10 16:31:27 +0200 | [diff] [blame] | 525 | Install `tox <https://pypi.org/project/tox>`_. |
Rich Bennett | ac93e0e | 2017-07-19 01:36:52 -0400 | [diff] [blame] | 526 | |
| 527 | .. code-block:: bash |
| 528 | |
Pawel Wieczorek | 6e82383 | 2019-07-10 16:31:27 +0200 | [diff] [blame] | 529 | sudo pip install tox |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 530 | |
| 531 | Download the DOC repository. |
| 532 | |
| 533 | .. code-block:: bash |
| 534 | |
| 535 | git clone http://gerrit.onap.org/r/doc |
| 536 | |
Rich Bennett | 9c3af50 | 2018-04-26 09:30:57 -0400 | [diff] [blame] | 537 | Build documentation using tox local environment & then open using any browser. |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 538 | |
| 539 | .. code-block:: bash |
| 540 | |
| 541 | cd doc |
Cédric Ollivier | 268209c | 2017-11-10 11:31:53 +0100 | [diff] [blame] | 542 | tox -elocal |
Rich Bennett | a9d6a44 | 2017-08-25 02:37:15 -0400 | [diff] [blame] | 543 | firefox docs/_build/html/index.html |
| 544 | |
Cédric Ollivier | 268209c | 2017-11-10 11:31:53 +0100 | [diff] [blame] | 545 | .. note:: Make sure to run `tox -elocal` and not just `tox`. |
Rich Bennett | 50d0d88 | 2019-03-08 17:03:58 -0500 | [diff] [blame] | 546 | This updates all submodule repositories that are integrated |
| 547 | by the doc project. |
Rich Bennett | 9c3af50 | 2018-04-26 09:30:57 -0400 | [diff] [blame] | 548 | |
Rich Bennett | d504dc8 | 2018-05-31 08:40:36 -0400 | [diff] [blame] | 549 | There are additional tox environment options for checking External |
Rene_Robert | bf4ab4e | 2019-07-01 18:12:40 +0200 | [diff] [blame] | 550 | URLs and Spelling. Use the tox environment options below and then |
Rich Bennett | 50d0d88 | 2019-03-08 17:03:58 -0500 | [diff] [blame] | 551 | look at the output with the Linux `more` or similar command |
| 552 | scan for output that applies to the files you are validating. |
Rich Bennett | 9c3af50 | 2018-04-26 09:30:57 -0400 | [diff] [blame] | 553 | |
| 554 | .. code-block:: bash |
| 555 | |
| 556 | tox -elinkcheck |
| 557 | more < docs/_build/linkcheck/output.txt |
| 558 | |
| 559 | tox -espellcheck |
| 560 | more < docs/_build/spellcheck/output.txt |