blob: f9be3f84191a0032a672faac6b4317cda8902759 [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 Williamsbf4cfe52018-05-14 16:29:57 -070020- job-template:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070021 id: verify-documentation
Zack Williams7468c362018-04-06 09:52:30 -070022 name: "verify-documentation"
23
24 triggers:
Zack Williams0e594a32018-05-15 19:30:38 -070025 - gerrit:
26 server-name: '{gerrit-server-name}'
Zack Williamsa1d1fc62018-05-15 10:51:31 -070027 dependency-jobs: '{dependency-jobs}'
Zack Williams0e594a32018-05-15 19:30:38 -070028 silent-start: true
29 trigger-on:
30 - patchset-created-event:
31 exclude-drafts: true
32 exclude-trivial-rebase: false
33 exclude-no-code-change: true
34 - draft-published-event
35 - comment-added-contains-event:
36 comment-contains-value: '(?i)^.*recheck$'
37 projects:
38 - project-compare-type: PLAIN
39 project-pattern: 'docs'
40 branches:
41 - branch-compare-type: REG_EXP
42 branch-pattern: '{branch-regexp}'
43 file-paths:
44 - compare-type: REG_EXP
45 pattern: '{all-files-regexp}'
46 - project-compare-type: REG_EXP
47 project-pattern: '{other-docs-repos-regexp}'
48 branches:
49 - branch-compare-type: REG_EXP
50 branch-pattern: '{branch-regexp}'
51 file-paths:
52 - compare-type: REG_EXP
53 pattern: '{doc-files-regexp}'
Kailash Khalasi21dc6192018-05-31 08:44:13 -070054 - compare-type: REG_EXP
55 pattern: '.*\.md'
Zack Williams7468c362018-04-06 09:52:30 -070056
57 properties:
58 - cord-infra-properties:
59 build-days-to-keep: '{build-days-to-keep}'
60 artifact-num-to-keep: '{artifact-num-to-keep}'
61
62 wrappers:
63 - lf-infra-wrappers:
64 build-timeout: '{build-timeout}'
65 jenkins-ssh-credential: '{jenkins-ssh-credential}'
66
67 scm:
68 - cord-infra-gerrit-repo-scm:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070069 manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
Zack Williams7468c362018-04-06 09:52:30 -070070 branch: '$GERRIT_BRANCH'
71 destination-dir: 'cord'
72
73 node: '{build-node}'
74 project-type: freestyle
75 concurrent: false
76
77 builders:
78 - cord-infra-gerrit-repo-patch:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070079 destination-dir: 'cord'
Zack Williams7468c362018-04-06 09:52:30 -070080 project: '$GERRIT_PROJECT'
81 change-number: '$GERRIT_CHANGE_NUMBER'
82 patchset-number: '$GERRIT_PATCHSET_NUMBER'
83 - shell: |
Zack Williams2d7b3502018-07-03 16:52:39 -070084 #!/usr/bin/env bash
85
86 # checkout is under cord
87 cd cord
88
89 # make repos checkout directory
90 mkdir -p docs/repos
91
92 # Find path to the repo, copy into docs
93 PROJECT_PATH=$(xmllint --xpath "string(//project[@name=\"$GERRIT_PROJECT\"]/@path)" .repo/manifest.xml)
94 cp -r "$PROJECT_PATH" "docs/repos/$(basename $PROJECT_PATH)"
95
96 # build docs, don't touch checkout under test
97 cd docs
98 SKIP_CHECKOUT="$GERRIT_PROJECT" make test
99
Zack Williams7468c362018-04-06 09:52:30 -0700100
Zack Williams7468c362018-04-06 09:52:30 -0700101- job-template:
Kailash Khalasica590552018-05-24 15:09:42 -0700102 id: publish-documentation
103 name: 'publish-documentation'
104
105 triggers:
Zack Williams9a021d72018-05-25 16:59:25 -0700106 - gerrit:
107 server-name: '{gerrit-server-name}'
Kailash Khalasica590552018-05-24 15:09:42 -0700108 dependency-jobs: '{dependency-jobs}'
Zack Williams9a021d72018-05-25 16:59:25 -0700109 silent-start: true
110 trigger-on:
111 - change-merged-event
112 projects:
113 - project-compare-type: PLAIN
114 project-pattern: 'docs'
115 branches:
116 - branch-compare-type: REG_EXP
117 branch-pattern: '{branch-regexp}'
118 file-paths:
119 - compare-type: REG_EXP
120 pattern: '{all-files-regexp}'
121 - project-compare-type: REG_EXP
122 project-pattern: '{other-docs-repos-regexp}'
123 branches:
124 - branch-compare-type: REG_EXP
125 branch-pattern: '{branch-regexp}'
126 file-paths:
127 - compare-type: REG_EXP
128 pattern: '{doc-files-regexp}'
Zack Williams642e5f72018-06-05 13:24:13 -0700129 - compare-type: REG_EXP
130 pattern: '.*\.md'
Kailash Khalasica590552018-05-24 15:09:42 -0700131
132 properties:
133 - cord-infra-properties:
134 build-days-to-keep: '{build-days-to-keep}'
135 artifact-num-to-keep: '{artifact-num-to-keep}'
136
137 wrappers:
138 - lf-infra-wrappers:
139 build-timeout: '{build-timeout}'
140 jenkins-ssh-credential: '{jenkins-ssh-credential}'
141
142 scm:
143 - cord-infra-gerrit-repo-scm:
144 manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
145 branch: '$GERRIT_BRANCH'
146 destination-dir: 'cord'
147
148 node: '{build-node}'
149 project-type: freestyle
150 concurrent: false
151
152 builders:
153 - shell: |
Zack Williams642e5f72018-06-05 13:24:13 -0700154 #!/usr/bin/env bash
Zack Williams9d661a42018-10-01 15:43:21 -0700155 set -e -o pipefail
Zack Williams642e5f72018-06-05 13:24:13 -0700156
157 # Set up the ssh host keys for the docs host
158 mkdir -p ~/.ssh
159 echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
160
Zack Williams7ac4efa2018-06-29 16:33:08 -0700161 # build gitbook docs
162 cd $WORKSPACE/cord/docs
Zack Williams2d7b3502018-07-03 16:52:39 -0700163
Kailash Khalasica590552018-05-24 15:09:42 -0700164 make build
Zack Williams2cad0322018-06-05 14:01:45 -0700165 rsync -rvzh --delete _book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
Zack Williams7ac4efa2018-06-29 16:33:08 -0700166
167 # build swagger docs
168 cd $WORKSPACE/cord/orchestration/xos/docs
169 make swagger_docs
170 rsync -rvzh --delete swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH/swagger
Zack Williams642e5f72018-06-05 13:24:13 -0700171