blob: 666b1074afe15ef3f7a483420e34996eba6ef39d (
plain)
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
|
How to setup the workflow of automatic 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>
cd <project>
**Inside the repository create the following structure:**::
gerrit.opnfv.org/<project> - docs/
/main.rst
/other-docus.rst
/images/*.png|*.jpg
**In order to obtain a nice .html & .pdf at then end you must write you documentation using reSt markup**
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
#the double {{ in file_cut="${{file%.*}}" is to escape jjb's yaml
**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" sections)::
- 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/
Please reffer to the releng repository for the correct indentation as JJB is very picky with those and also for the rest of the code that is missing in the example code and replaced by "...".
Also you must have your documentation under docs/ in the repository or gsutil will fail to copy them; for customizations you might need to addapt build-docu.sh as we did for genesis project as different documents need to go into different places.
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)**
http://artifacts.opnfv.org/
example: http://artifacts.opnfv.org/opnfvdocs/docs/enable_docu_gen.pdf
Here you can download the PDF version of this guide.
**Scrape content from html artifacts on wiki**
This section describes how the html build artifacts can be made visible on Wiki using he scrape method.
In order to have you documentation on Wiki you need to create a wiki page and include an adaption of the code below:
example::
{{scrape>http://artifacts.opnfv.org/opnfvdocs/docs/enable_docu_gen.html}}
Please try to write documentation as accurate and clear as possible as once reviewed and merged it will be automatically built and displayed on Wiki and everyone would apreciate a good written/nice looking guide.
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 solution found.
For html generation it also supports css styles if needed.
|