blob: 1f987637f6d8e0305e10e4dd0cfe933dab85c452 [file] [log] [blame]
Zack Williams7468c362018-04-06 09:52:30 -07001---
2# CORD documentation verification and publish tasks
3
4- project:
5 name: verify-docs
6
Zack Williams7468c362018-04-06 09:52:30 -07007 jobs:
8 - 'verify-documentation':
Zack Williams9a021d72018-05-25 16:59:25 -07009 other-docs-repos-regexp: '.*'
Zack Williamsbf4cfe52018-05-14 16:29:57 -070010 branch-regexp: '{modern-branches-regexp}'
Zack Williams7468c362018-04-06 09:52:30 -070011
12- project:
13 name: publish-docs
14
15 jobs:
16 - 'publish-documentation':
Zack Williams9a021d72018-05-25 16:59:25 -070017 other-docs-repos-regexp: '.*'
Kailash Khalasica590552018-05-24 15:09:42 -070018 branch-regexp: '{modern-branches-regexp}'
Zack Williams7468c362018-04-06 09:52:30 -070019
Zack Williams5364d1f2018-12-19 16:00:03 -070020- project:
21 name: publish-xos-docs
22
23 jobs:
24 - 'publish-xos-documentation':
25 branch-regexp: '{modern-branches-regexp}'
26
Zack Williamsbf4cfe52018-05-14 16:29:57 -070027- job-template:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070028 id: verify-documentation
Zack Williams7468c362018-04-06 09:52:30 -070029 name: "verify-documentation"
30
31 triggers:
Zack Williams0e594a32018-05-15 19:30:38 -070032 - gerrit:
33 server-name: '{gerrit-server-name}'
Zack Williamsa1d1fc62018-05-15 10:51:31 -070034 dependency-jobs: '{dependency-jobs}'
Zack Williams0e594a32018-05-15 19:30:38 -070035 silent-start: true
36 trigger-on:
37 - patchset-created-event:
38 exclude-drafts: true
39 exclude-trivial-rebase: false
40 exclude-no-code-change: true
41 - draft-published-event
42 - comment-added-contains-event:
43 comment-contains-value: '(?i)^.*recheck$'
44 projects:
45 - project-compare-type: PLAIN
46 project-pattern: 'docs'
47 branches:
48 - branch-compare-type: REG_EXP
49 branch-pattern: '{branch-regexp}'
50 file-paths:
51 - compare-type: REG_EXP
52 pattern: '{all-files-regexp}'
53 - project-compare-type: REG_EXP
54 project-pattern: '{other-docs-repos-regexp}'
55 branches:
56 - branch-compare-type: REG_EXP
57 branch-pattern: '{branch-regexp}'
58 file-paths:
59 - compare-type: REG_EXP
60 pattern: '{doc-files-regexp}'
Kailash Khalasi21dc6192018-05-31 08:44:13 -070061 - compare-type: REG_EXP
62 pattern: '.*\.md'
Zack Williams7468c362018-04-06 09:52:30 -070063
64 properties:
65 - cord-infra-properties:
66 build-days-to-keep: '{build-days-to-keep}'
67 artifact-num-to-keep: '{artifact-num-to-keep}'
68
69 wrappers:
70 - lf-infra-wrappers:
Zack Williamse779dc02018-12-13 09:31:49 -070071 build-timeout: '20'
Zack Williams7468c362018-04-06 09:52:30 -070072 jenkins-ssh-credential: '{jenkins-ssh-credential}'
73
74 scm:
75 - cord-infra-gerrit-repo-scm:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070076 manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
Zack Williams7468c362018-04-06 09:52:30 -070077 branch: '$GERRIT_BRANCH'
78 destination-dir: 'cord'
79
Zack Williamse779dc02018-12-13 09:31:49 -070080 node: 'ubuntu16.04-basebuild-1c-2g'
Zack Williams7468c362018-04-06 09:52:30 -070081 project-type: freestyle
82 concurrent: false
83
84 builders:
85 - cord-infra-gerrit-repo-patch:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070086 destination-dir: 'cord'
Zack Williams7468c362018-04-06 09:52:30 -070087 project: '$GERRIT_PROJECT'
88 change-number: '$GERRIT_CHANGE_NUMBER'
89 patchset-number: '$GERRIT_PATCHSET_NUMBER'
90 - shell: |
Zack Williams2d7b3502018-07-03 16:52:39 -070091 #!/usr/bin/env bash
92
93 # checkout is under cord
94 cd cord
95
96 # make repos checkout directory
97 mkdir -p docs/repos
98
99 # Find path to the repo, copy into docs
100 PROJECT_PATH=$(xmllint --xpath "string(//project[@name=\"$GERRIT_PROJECT\"]/@path)" .repo/manifest.xml)
101 cp -r "$PROJECT_PATH" "docs/repos/$(basename $PROJECT_PATH)"
102
Zack Williamsa0d36e32018-12-19 07:43:09 -0700103 # build docs, don't touch checkout under test, capture test result
Zack Williams2d7b3502018-07-03 16:52:39 -0700104 cd docs
105 SKIP_CHECKOUT="$GERRIT_PROJECT" make test
Zack Williamsa0d36e32018-12-19 07:43:09 -0700106 test_result=$?
107
108 # cleanup
109 make clean
110
111 exit $test_result
Zack Williams2d7b3502018-07-03 16:52:39 -0700112
Zack Williams7468c362018-04-06 09:52:30 -0700113
Zack Williams7468c362018-04-06 09:52:30 -0700114- job-template:
Kailash Khalasica590552018-05-24 15:09:42 -0700115 id: publish-documentation
116 name: 'publish-documentation'
117
118 triggers:
Zack Williams9a021d72018-05-25 16:59:25 -0700119 - gerrit:
120 server-name: '{gerrit-server-name}'
Kailash Khalasica590552018-05-24 15:09:42 -0700121 dependency-jobs: '{dependency-jobs}'
Zack Williams9a021d72018-05-25 16:59:25 -0700122 silent-start: true
123 trigger-on:
124 - change-merged-event
125 projects:
126 - project-compare-type: PLAIN
127 project-pattern: 'docs'
128 branches:
129 - branch-compare-type: REG_EXP
130 branch-pattern: '{branch-regexp}'
131 file-paths:
132 - compare-type: REG_EXP
133 pattern: '{all-files-regexp}'
134 - project-compare-type: REG_EXP
135 project-pattern: '{other-docs-repos-regexp}'
136 branches:
137 - branch-compare-type: REG_EXP
138 branch-pattern: '{branch-regexp}'
139 file-paths:
140 - compare-type: REG_EXP
141 pattern: '{doc-files-regexp}'
Zack Williams642e5f72018-06-05 13:24:13 -0700142 - compare-type: REG_EXP
143 pattern: '.*\.md'
Kailash Khalasica590552018-05-24 15:09:42 -0700144
145 properties:
146 - cord-infra-properties:
147 build-days-to-keep: '{build-days-to-keep}'
148 artifact-num-to-keep: '{artifact-num-to-keep}'
149
150 wrappers:
151 - lf-infra-wrappers:
Zack Williamse779dc02018-12-13 09:31:49 -0700152 build-timeout: '20'
Kailash Khalasica590552018-05-24 15:09:42 -0700153 jenkins-ssh-credential: '{jenkins-ssh-credential}'
154
155 scm:
156 - cord-infra-gerrit-repo-scm:
157 manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
158 branch: '$GERRIT_BRANCH'
159 destination-dir: 'cord'
160
Zack Williamse779dc02018-12-13 09:31:49 -0700161 node: 'ubuntu16.04-basebuild-1c-2g'
Kailash Khalasica590552018-05-24 15:09:42 -0700162 project-type: freestyle
163 concurrent: false
164
165 builders:
166 - shell: |
Zack Williams642e5f72018-06-05 13:24:13 -0700167 #!/usr/bin/env bash
Zack Williams9d661a42018-10-01 15:43:21 -0700168 set -e -o pipefail
Zack Williams642e5f72018-06-05 13:24:13 -0700169
170 # Set up the ssh host keys for the docs host
171 mkdir -p ~/.ssh
172 echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
173
Zack Williams7ac4efa2018-06-29 16:33:08 -0700174 # build gitbook docs
175 cd $WORKSPACE/cord/docs
Zack Williams2d7b3502018-07-03 16:52:39 -0700176
Kailash Khalasica590552018-05-24 15:09:42 -0700177 make build
Zack Williams2cad0322018-06-05 14:01:45 -0700178 rsync -rvzh --delete _book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
Zack Williams7ac4efa2018-06-29 16:33:08 -0700179
180 # build swagger docs
181 cd $WORKSPACE/cord/orchestration/xos/docs
182 make swagger_docs
183 rsync -rvzh --delete swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH/swagger
Zack Williams642e5f72018-06-05 13:24:13 -0700184
Zack Williams5364d1f2018-12-19 16:00:03 -0700185
186- job-template:
187 id: publish-xos-documentation
188 name: 'publish-xos-documentation'
189
190 triggers:
191 - gerrit:
192 server-name: '{gerrit-server-name}'
193 dependency-jobs: '{dependency-jobs}'
194 silent-start: true
195 trigger-on:
196 - change-merged-event
197 projects:
198 - project-compare-type: PLAIN
199 project-pattern: 'xos'
200 branches:
201 - branch-compare-type: REG_EXP
202 branch-pattern: '{branch-regexp}'
203 file-paths:
204 - compare-type: REG_EXP
205 pattern: '{doc-files-regexp}'
206 - compare-type: REG_EXP
207 pattern: '.*\.md'
208
209 properties:
210 - cord-infra-properties:
211 build-days-to-keep: '{build-days-to-keep}'
212 artifact-num-to-keep: '{artifact-num-to-keep}'
213
214 wrappers:
215 - lf-infra-wrappers:
216 build-timeout: '20'
217 jenkins-ssh-credential: '{jenkins-ssh-credential}'
218
219 scm:
220 - cord-infra-gerrit-repo-scm:
221 manifest-url: '{gerrit-server-url}/xos-manifest.git'
222 branch: '$GERRIT_BRANCH'
223 destination-dir: 'cord'
224
225 node: 'ubuntu16.04-basebuild-1c-2g'
226 project-type: freestyle
227 concurrent: false
228
229 builders:
230 - shell: |
231 #!/usr/bin/env bash
232 set -e -o pipefail
233
234 # Set up the ssh host keys for the docs host
235 mkdir -p ~/.ssh
236 echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
237
238 # build gitbook docs
239 cd $WORKSPACE/cord/xos-core/docs
240
241 make build
242 rsync -rvzh --delete _book/ guide.opencord.org:/var/www/xos-guide
243