fix releng path in composite doc builder
[releng.git] / jjb / opnfvdocs / opnfvdocs.yml
1 ########################
2 # Job configuration for opnfvdocs
3 ########################
4 - project:
5
6     name: opnfvdocs
7
8     project: '{name}'
9
10     jobs:
11         - 'opnfvdocs-verify-{stream}'
12         - 'opnfvdocs-merge-{stream}'
13         - 'opnfvdocs-daily-{stream}'
14
15     stream:
16         - master:
17             branch: '{stream}'
18             gs-pathname: ''
19         - brahmaputra:
20             branch: 'stable/{stream}'
21             gs-pathname: '/{stream}'
22
23 ########################
24 # job templates
25 ########################
26
27 - job-template:
28     name: 'opnfvdocs-verify-{stream}'
29
30     parameters:
31         - project-parameter:
32             project: $GERRIT_PROJECT
33         - gerrit-parameter:
34             branch: '{branch}'
35         - string:
36             name: GIT_CLONE_BASE
37             default: ssh://gerrit.opnfv.org:29418
38             description: "Used for overriding the GIT URL coming from parameters macro."
39
40     scm:
41         - gerrit-trigger-scm:
42             credentials-id: '{ssh-credentials}'
43             refspec: '$GERRIT_REFSPEC'
44             choosing-strategy: 'gerrit'
45
46     triggers:
47         - gerrit:
48             trigger-on:
49                 - patchset-created-event:
50                     exclude-drafts: 'false'
51                     exclude-trivial-rebase: 'false'
52                     exclude-no-code-change: 'false'
53                 - draft-published-event
54                 - comment-added-contains-event:
55                     comment-contains-value: 'recheck'
56                 - comment-added-contains-event:
57                     comment-contains-value: 'reverify'
58             projects:
59               - project-compare-type: 'REG_EXP'
60                 project-pattern: '{project}'
61                 branches:
62                   - branch-compare-type: 'ANT'
63                     branch-pattern: '**/{branch}'
64                 file-paths:
65                   - compare-type: ANT
66                     pattern: 'docs/**'
67
68     builders:
69         - clone-opnfv-repos
70         - build-html-and-pdf-docs-output
71         - upload-under-review-docs-to-opnfv-artifacts
72         - report-docs-build-result-to-gerrit
73
74 - job-template:
75     name: 'opnfvdocs-merge-{stream}'
76
77     parameters:
78         - project-parameter:
79             project: $GERRIT_PROJECT
80         - gerrit-parameter:
81             branch: '{branch}'
82         - string:
83             name: GIT_CLONE_BASE
84             default: ssh://gerrit.opnfv.org:29418
85             description: "Used for overriding the GIT URL coming from parameters macro."
86         - string:
87             name: GS_URL
88             default: '$GS_BASE{gs-pathname}'
89             description: "Directory where the build artifact will be located upon the completion of the build."
90
91     scm:
92         - gerrit-trigger-scm:
93             credentials-id: '{ssh-credentials}'
94             refspec: '$GERRIT_REFSPEC'
95             choosing-strategy: 'gerrit'
96
97     triggers:
98         - gerrit:
99             trigger-on:
100                 - change-merged-event
101                 - comment-added-contains-event:
102                     comment-contains-value: 'remerge'
103             projects:
104               - project-compare-type: 'REG_EXP'
105                 project-pattern: '{project}'
106                 branches:
107                   - branch-compare-type: 'ANT'
108                     branch-pattern: '**/{branch}'
109                 file-paths:
110                   - compare-type: ANT
111                     pattern: 'docs/**'
112
113     builders:
114         - clone-opnfv-repos
115         - build-html-and-pdf-docs-output
116 #        - upload-generated-docs-to-opnfv-artifacts
117         - report-docs-build-result-to-gerrit
118         - remove-old-docs-from-opnfv-artifacts
119
120 - job-template:
121     name: 'opnfvdocs-daily-{stream}'
122
123     parameters:
124         - project-parameter:
125             project: '{project}'
126         - string:
127             name: GS_URL
128             default: '$GS_BASE{gs-pathname}'
129             description: "Directory where the build artifact will be located upon the completion of the build."
130         - string:
131             name: GIT_CLONE_BASE
132             default: ssh://gerrit.opnfv.org:29418
133             description: "Used for overriding the GIT URL coming from parameters macro."
134         - string:
135             name: GERRIT_BRANCH
136             default: '{branch}'
137             description: 'Specify the branch in this way in order to be able to use clone-opnfv-repos builder.'
138
139     scm:
140         - git-scm:
141             credentials-id: '{ssh-credentials}'
142             refspec: ''
143             branch: '{branch}'
144
145     triggers:
146         - timed: '0 H/6 * * *'
147
148     builders:
149         - clone-opnfv-repos
150         - build-html-and-pdf-docs-output
151 #        - upload-generated-docs-to-opnfv-artifacts
152
153 - builder:
154     name: clone-opnfv-repos
155
156     # TODO(r-mibu): fix job name which is not relevant anymore
157     #               AND move this script into opnfvdocs repo
158
159     builders:
160         - shell: |
161             #!/bin/bash
162             set -o errexit
163             set -o nounset
164             set -o pipefail
165
166             tmp=$WORKSPACE/composite_tmp
167             [[ -d $tmp ]] && rm -rf $tmp
168             mkdir -p $tmp
169             mkdir -p $WORKSPACE/docs/projects
170
171             pushd $tmp
172
173             # clone releng repo to get repo list
174             echo "Cloning releng repo"
175             git clone $GIT_CLONE_BASE/releng --branch master --depth 1 --quiet
176             repos=$(grep -v '^#' releng/jjb/opnfvdocs/project.cfg | sort)
177
178             echo
179             echo "Cloning repos of participating OPNFV Projects and copying docs"
180             echo
181             echo "--------------------------------------------------------"
182             for repo in $repos; do
183                 echo "    $repo ($GERRIT_BRANCH)"
184                 git clone $GIT_CLONE_BASE/$repo --branch $GERRIT_BRANCH --depth 1 --quiet
185                 cp -r $repo/docs $WORKSPACE/docs/projects/$repo
186             done
187             echo "--------------------------------------------------------"
188             echo
189
190             echo "Creating document links"
191             for guide in configguide userguide
192             do
193                 link_list=$WORKSPACE/docs/$guide/projects-$guide.rst
194                 for repo in $repos
195                 do
196                     file=projects/$repo/$guide/$guide.rst
197                     [[ -e $WORKSPACE/docs/$file ]] || continue
198                     echo "" >> $link_list
199                     echo "$repo:" >> $link_list
200                     echo ".. include:: ../$file" >> $link_list
201                 done
202             done
203
204             popd
205             rm -rf $tmp
206
207             echo "Done"