Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 1 | --- |
| 2 | # CORD documentation verification and publish tasks |
| 3 | |
| 4 | - project: |
| 5 | name: verify-docs |
| 6 | |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 7 | jobs: |
| 8 | - 'verify-documentation': |
Zack Williams | 9a021d7 | 2018-05-25 16:59:25 -0700 | [diff] [blame] | 9 | other-docs-repos-regexp: '.*' |
Zack Williams | bf4cfe5 | 2018-05-14 16:29:57 -0700 | [diff] [blame] | 10 | branch-regexp: '{modern-branches-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 11 | |
| 12 | - project: |
| 13 | name: publish-docs |
| 14 | |
| 15 | jobs: |
| 16 | - 'publish-documentation': |
Zack Williams | 9a021d7 | 2018-05-25 16:59:25 -0700 | [diff] [blame] | 17 | other-docs-repos-regexp: '.*' |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 18 | branch-regexp: '{modern-branches-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 19 | |
Zack Williams | bf4cfe5 | 2018-05-14 16:29:57 -0700 | [diff] [blame] | 20 | - job-template: |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 21 | id: verify-documentation |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 22 | name: "verify-documentation" |
| 23 | |
| 24 | triggers: |
Zack Williams | 0e594a3 | 2018-05-15 19:30:38 -0700 | [diff] [blame] | 25 | - gerrit: |
| 26 | server-name: '{gerrit-server-name}' |
Zack Williams | a1d1fc6 | 2018-05-15 10:51:31 -0700 | [diff] [blame] | 27 | dependency-jobs: '{dependency-jobs}' |
Zack Williams | 0e594a3 | 2018-05-15 19:30:38 -0700 | [diff] [blame] | 28 | 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 Khalasi | 21dc619 | 2018-05-31 08:44:13 -0700 | [diff] [blame] | 54 | - compare-type: REG_EXP |
| 55 | pattern: '.*\.md' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 56 | |
| 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: |
Zack Williams | e779dc0 | 2018-12-13 09:31:49 -0700 | [diff] [blame] | 64 | build-timeout: '20' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 65 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 66 | |
| 67 | scm: |
| 68 | - cord-infra-gerrit-repo-scm: |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 69 | manifest-url: '{gerrit-server-url}/{cord-repo-manifest}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 70 | branch: '$GERRIT_BRANCH' |
| 71 | destination-dir: 'cord' |
| 72 | |
Zack Williams | e779dc0 | 2018-12-13 09:31:49 -0700 | [diff] [blame] | 73 | node: 'ubuntu16.04-basebuild-1c-2g' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 74 | project-type: freestyle |
| 75 | concurrent: false |
| 76 | |
| 77 | builders: |
| 78 | - cord-infra-gerrit-repo-patch: |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 79 | destination-dir: 'cord' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 80 | project: '$GERRIT_PROJECT' |
| 81 | change-number: '$GERRIT_CHANGE_NUMBER' |
| 82 | patchset-number: '$GERRIT_PATCHSET_NUMBER' |
| 83 | - shell: | |
Zack Williams | 2d7b350 | 2018-07-03 16:52:39 -0700 | [diff] [blame] | 84 | #!/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 | |
Zack Williams | a0d36e3 | 2018-12-19 07:43:09 -0700 | [diff] [blame^] | 96 | # build docs, don't touch checkout under test, capture test result |
Zack Williams | 2d7b350 | 2018-07-03 16:52:39 -0700 | [diff] [blame] | 97 | cd docs |
| 98 | SKIP_CHECKOUT="$GERRIT_PROJECT" make test |
Zack Williams | a0d36e3 | 2018-12-19 07:43:09 -0700 | [diff] [blame^] | 99 | test_result=$? |
| 100 | |
| 101 | # cleanup |
| 102 | make clean |
| 103 | |
| 104 | exit $test_result |
Zack Williams | 2d7b350 | 2018-07-03 16:52:39 -0700 | [diff] [blame] | 105 | |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 106 | |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 107 | - job-template: |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 108 | id: publish-documentation |
| 109 | name: 'publish-documentation' |
| 110 | |
| 111 | triggers: |
Zack Williams | 9a021d7 | 2018-05-25 16:59:25 -0700 | [diff] [blame] | 112 | - gerrit: |
| 113 | server-name: '{gerrit-server-name}' |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 114 | dependency-jobs: '{dependency-jobs}' |
Zack Williams | 9a021d7 | 2018-05-25 16:59:25 -0700 | [diff] [blame] | 115 | silent-start: true |
| 116 | trigger-on: |
| 117 | - change-merged-event |
| 118 | projects: |
| 119 | - project-compare-type: PLAIN |
| 120 | project-pattern: 'docs' |
| 121 | branches: |
| 122 | - branch-compare-type: REG_EXP |
| 123 | branch-pattern: '{branch-regexp}' |
| 124 | file-paths: |
| 125 | - compare-type: REG_EXP |
| 126 | pattern: '{all-files-regexp}' |
| 127 | - project-compare-type: REG_EXP |
| 128 | project-pattern: '{other-docs-repos-regexp}' |
| 129 | branches: |
| 130 | - branch-compare-type: REG_EXP |
| 131 | branch-pattern: '{branch-regexp}' |
| 132 | file-paths: |
| 133 | - compare-type: REG_EXP |
| 134 | pattern: '{doc-files-regexp}' |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 135 | - compare-type: REG_EXP |
| 136 | pattern: '.*\.md' |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 137 | |
| 138 | properties: |
| 139 | - cord-infra-properties: |
| 140 | build-days-to-keep: '{build-days-to-keep}' |
| 141 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 142 | |
| 143 | wrappers: |
| 144 | - lf-infra-wrappers: |
Zack Williams | e779dc0 | 2018-12-13 09:31:49 -0700 | [diff] [blame] | 145 | build-timeout: '20' |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 146 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 147 | |
| 148 | scm: |
| 149 | - cord-infra-gerrit-repo-scm: |
| 150 | manifest-url: '{gerrit-server-url}/{cord-repo-manifest}' |
| 151 | branch: '$GERRIT_BRANCH' |
| 152 | destination-dir: 'cord' |
| 153 | |
Zack Williams | e779dc0 | 2018-12-13 09:31:49 -0700 | [diff] [blame] | 154 | node: 'ubuntu16.04-basebuild-1c-2g' |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 155 | project-type: freestyle |
| 156 | concurrent: false |
| 157 | |
| 158 | builders: |
| 159 | - shell: | |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 160 | #!/usr/bin/env bash |
Zack Williams | 9d661a4 | 2018-10-01 15:43:21 -0700 | [diff] [blame] | 161 | set -e -o pipefail |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 162 | |
| 163 | # Set up the ssh host keys for the docs host |
| 164 | mkdir -p ~/.ssh |
| 165 | echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts |
| 166 | |
Zack Williams | 7ac4efa | 2018-06-29 16:33:08 -0700 | [diff] [blame] | 167 | # build gitbook docs |
| 168 | cd $WORKSPACE/cord/docs |
Zack Williams | 2d7b350 | 2018-07-03 16:52:39 -0700 | [diff] [blame] | 169 | |
Kailash Khalasi | ca59055 | 2018-05-24 15:09:42 -0700 | [diff] [blame] | 170 | make build |
Zack Williams | 2cad032 | 2018-06-05 14:01:45 -0700 | [diff] [blame] | 171 | rsync -rvzh --delete _book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH |
Zack Williams | 7ac4efa | 2018-06-29 16:33:08 -0700 | [diff] [blame] | 172 | |
| 173 | # build swagger docs |
| 174 | cd $WORKSPACE/cord/orchestration/xos/docs |
| 175 | make swagger_docs |
| 176 | rsync -rvzh --delete swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH/swagger |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 177 | |