1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
How to setup the workflow of documentation build for your project
==================================================================
**Setup you repository and then clone locally**
ssh-add your-ssh-key
git clone ssh://<username>@gerrit.opnfv.org:29418/<project>
**Inside the repository create the following structure:**
gerrit.opnfv.org/<project> - docs/
--- docs/main.rst
--- docs/other-docus.rst
--- docs/images/*.png|*.jpg
**In order to obtain a nice .html & .pdf at then end you must write you documentation using reSt markup**
a quick guide: http://docutils.sourceforge.net/docs/user/rst/quickref.html
**Clone the releng repository so you can created jobs for JJB**::
git clone ssh://<username>@gerrit.opnfv.org:29418/releng
Enter the project settings::
cd releng/jjb/<project>/
**Create build-docu.sh**
The script is the same for most of the projects and you can just copy it under your project in releng/jjb/<project>/
example: cp releng/jjb/opnfvdocs/build-docu.sh releng/jjb/<your-project>/::
#!/bin/bash
set -xv
for file in $(find . -type f -iname '*.rst'); do
file_cut="${{file%.*}}"
html_file=$file_cut".html"
pdf_file=$file_cut".pdf"
rst2html $file > $html_file
rst2pdf $file -o $pdf_file
done
**Edit <your-project>.yml**::
vi releng/jjb/<your-project>/<your-project>.yml
Make sure you have the job-templates set right
example: less releng/jjb/opnfvdocs/opnfvdocs.yml (pay extra attention at the "builder" section)::
- job-template:
name: 'opnfvdocs-daily-{stream}'
...
builders:
- shell:
!include-raw build-docu.sh
- shell: |
echo $PATH
/usr/local/bin/gsutil cp docs/*.pdf gs://artifacts.opnfv.org/opnfvdocs/docs/
/usr/local/bin/gsutil cp docs/*.html gs://artifacts.opnfv.org/opnfvdocs/docs/
- job-template:
name: 'opnfvdocs-verify'
...
builders:
- shell:
!include-raw build-docu.sh
- job-template:
name: 'opnfvdocs-merge'
...
builders:
- shell:
!include-raw build-docu.sh
- shell: |
/usr/local/bin/gsutil cp docs/*.pdf gs://artifacts.opnfv.org/opnfvdocs/docs/
/usr/local/bin/gsutil cp docs/*.html gs://artifacts.opnfv.org/opnfvdocs/docs/
Stage files::
git add build-docu.sh <project>.yml
Commit change with --signoff::
git commit --signoff
Send code for review in Gerrit::
git review -v
**Create the documentation using the recommended structure in your repository and submit to gerrit for review**
**Jenkins will take over and produce artifacts in the form of .html & .pdf**
Jenkins has the proper packages installed in order to produce the artifacts.
**Artifacts are stored on Google Storage (still to decide where, structure and how to present them)**
**NOTE:** 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.
**Other options:**
1. Doxygen plugin -> HTML published plugin (html)/ LaTeX (pdf)
---------------------------------------------------------------
Description:
- html: using Doxygen plugin + HTML publisher
It involves some customization at doxygen level + custom html header/footer
- pdf: it generates a .pdf using latex
Final destination of generated files needs to be discussed as it will be part of a Bash script in Post-actions.
Input files: .md , .rst
Output: .html & .pdf
Pros:
- standard tools: doxygen, html publisher, LaTeX suite
- doxygen plugin available in Jenkins, you just need to install it; html publisher plugin available in Jenkins, you just need to install it
- destination files are generated fast
- standard reStructuredText or Markdown
Cons:
- takes some time to customize the output in matters of template, requires custom html header/footer
- latex suite is quite substantial in amount of packages and consumed space (around 1.2 GB)
Tested: roughly, functional tests only
2. Maven & clouddocs-maven-plugin (actually used to generate openstack-manuals)
--------------------------------------------------------------------------------
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
Input files: .xml
Output: .html & .pdf
Pros:
- quite easy for initial setup
- uses openstack documentation generation flows as for openstack-manuals (clouddocs-maven-plugin), maven installs all you need generate the documentation
Cons:
- could be tricky to generate a custom layout, knowledge about Maven plugins required, .pom editing
- dependent of multiple maven plugins
- input files are .xml and xml editing knowledge is required
Tested: roughly, functional tests only
3. Sphinx & LaTeX suite
------------------------
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
Input files: .rst as default
Output: .html & .pdf
Pros:
- standard tools: Python Sphinx, LaTeX suite
- destination files are generated fast
- standard reStructuredText as default; other inputs can be configured
- Sphinx's installation is very clean in matters of folder structure; the cleanest from all tested variants
- latex suite is also easy to install via yum/apt and available in general repos
- everyone is migration from other tools to Spinx lately; it provides more control and better looking documentation
- can be used also for source-code documentation, specially if you use Python
Cons:
- takes some time to customize the output in matters of template, requires custom html header/footer
- latex suite is quite substantial in amount of packages and consumed space (around 1.2 GB)
Tested: roughly, functional tests only
|