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