1 How to setup the workflow of automatic documentation build for your project
2 ----------------------------------------------------------------------------
5 **Setup you repository and then clone locally**::
9 git clone ssh://<username>@gerrit.opnfv.org:29418/<project>
14 **Inside the repository create the following structure:**::
16 gerrit.opnfv.org/<project> - docs/
22 **In order to obtain a nice .html & .pdf at then end you must write you documentation using reSt markup**
24 quick guide: http://docutils.sourceforge.net/docs/user/rst/quickref.html
27 **Clone the releng repository so you can created jobs for JJB**::
29 git clone ssh://<username>@gerrit.opnfv.org:29418/releng
32 Enter the project settings::
34 cd releng/jjb/<project>/
37 **Create build-docu.sh**
39 The script is the same for most of the projects and you can just copy it under your project in releng/jjb/<project>/
41 example: cp releng/jjb/opnfvdocs/build-docu.sh releng/jjb/<your-project>/::
45 for file in $(find . -type f -iname '*.rst'); do
46 file_cut="${{file%.*}}"
47 html_file=$file_cut".html"
48 pdf_file=$file_cut".pdf"
49 rst2html $file > $html_file
50 rst2pdf $file -o $pdf_file
54 #the double {{ in file_cut="${{file%.*}}" is to escape jjb's yaml
58 **Edit <your-project>.yml**::
60 vi releng/jjb/<your-project>/<your-project>.yml
63 Make sure you have the job-templates set right
65 example: less releng/jjb/opnfvdocs/opnfvdocs.yml (pay extra attention at the "builder" sections)::
68 name: 'opnfvdocs-daily-{stream}'
72 !include-raw build-docu.sh
75 /usr/local/bin/gsutil cp docs/*.pdf gs://artifacts.opnfv.org/opnfvdocs/docs/
76 /usr/local/bin/gsutil cp docs/*.html gs://artifacts.opnfv.org/opnfvdocs/docs/
80 name: 'opnfvdocs-verify'
84 !include-raw build-docu.sh
88 name: 'opnfvdocs-merge'
92 !include-raw build-docu.sh
94 /usr/local/bin/gsutil cp docs/*.pdf gs://artifacts.opnfv.org/opnfvdocs/docs/
95 /usr/local/bin/gsutil cp docs/*.html gs://artifacts.opnfv.org/opnfvdocs/docs/
101 git add build-docu.sh <project>.yml
103 Commit change with --signoff::
108 Send code for review in Gerrit::
115 **Create the documentation using the recommended structure in your repository and submit to gerrit for review**
118 **Jenkins will take over and produce artifacts in the form of .html & .pdf**
120 Jenkins has the proper packages installed in order to produce the artifacts.
123 **Artifacts are stored on Google Storage (still to decide where, structure and how to present them)**
125 http://artifacts.opnfv.org/
127 example: http://artifacts.opnfv.org/opnfvdocs/docs/enable_docu_gen.pdf
130 **Scrape content from html artifacts on wiki**
132 example of what you sould write on wiki, below::
134 {{scrape>http://artifacts.opnfv.org/opnfvdocs/docs/enable_docu_gen.html}}
140 In order to generate html & pdf documentation the needed packages are rst2pdf & python-docutils if the Jenkins is CentOS/RHEL; many variants have been tested but this is the cleanest as a solution.
145 **Other options to generate documentation that we tested:**
148 **Doxygen plugin -> HTML published plugin (html)/ LaTeX (pdf)**
151 Description: This was the first discovered method
153 - html: using Doxygen plugin + HTML publisher
154 It involves some customization at doxygen level + custom html header/footer
156 - pdf: it generates a .pdf using latex
158 - Input files: .md , .rst
160 - Output: .html & .pdf
164 - standard tools: doxygen, html publisher, LaTeX suite
165 - doxygen plugin available in Jenkins, you just need to install it; html publisher plugin available in Jenkins, you just need to install it
166 - destination files are generated fast
167 - standard reStructuredText or Markdown
171 - takes some time to customize the output in matters of template, requires custom html header/footer
172 - latex suite is quite substantial in amount of packages and consumed space (around 1.2 GB)
174 - Tested: roughly, functional tests only
178 **Maven & clouddocs-maven-plugin (actually used to generate openstack-manuals)**
181 Description: It represents the standard tool to generate Openstack documentation manuals, uses maven, maven plugins, clouddocs-maven-plugins; location of finally generated files is the object of a small Bash script that will reside as Post-actions
185 - Output: .html & .pdf
189 - quite easy for initial setup
190 - uses openstack documentation generation flows as for openstack-manuals (clouddocs-maven-plugin), maven installs all you need generate the documentation
194 - could be tricky to generate a custom layout, knowledge about Maven plugins required, .pom editing
195 - dependent of multiple maven plugins
196 - input files are .xml and xml editing knowledge is required
198 - Tested: roughly, functional tests only
202 **Sphinx & LaTeX suite**
205 Description: The easiest to install, the cleanest in matter of folder & files structure, uses standard tools available in repositories; location of finally generated files is the object of a small Bash script that will reside as Post-actions
207 - Input files: .rst as default
209 - Output: .html & .pdf
213 - standard tools: Python Sphinx, LaTeX suite
214 - destination files are generated fast
215 - standard reStructuredText as default; other inputs can be configured
216 - Sphinx's installation is very clean in matters of folder structure; the cleanest from all tested variants
217 - latex suite is also easy to install via yum/apt and available in general repos
218 - everyone is migration from other tools to Spinx lately; it provides more control and better looking documentation
219 - can be used also for source-code documentation, specially if you use Python
223 - takes some time to customize the output in matters of template, requires custom html header/footer
224 - latex suite is quite substantial in amount of packages and consumed space (around 1.2 GB)
226 - Tested: roughly, functional tests only