blob: 15227c19e45d288dbe1c46434e1c95af7d0f3cb9 [file] [log] [blame]
---
# CORD documentation verification and publish tasks
- project:
name: verify-docs
jobs:
- 'verify-documentation':
other-docs-repos-regexp: '.*'
branch-regexp: '{modern-branches-regexp}'
- project:
name: publish-docs
jobs:
- 'publish-documentation':
other-docs-repos-regexp: '.*'
branch-regexp: '{modern-branches-regexp}'
- job-template:
id: verify-documentation
name: "verify-documentation"
triggers:
- gerrit:
server-name: '{gerrit-server-name}'
dependency-jobs: '{dependency-jobs}'
silent-start: true
trigger-on:
- patchset-created-event:
exclude-drafts: true
exclude-trivial-rebase: false
exclude-no-code-change: true
- draft-published-event
- comment-added-contains-event:
comment-contains-value: '(?i)^.*recheck$'
projects:
- project-compare-type: PLAIN
project-pattern: 'docs'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{all-files-regexp}'
- project-compare-type: REG_EXP
project-pattern: '{other-docs-repos-regexp}'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{doc-files-regexp}'
- compare-type: REG_EXP
pattern: '.*\.md'
properties:
- cord-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
wrappers:
- lf-infra-wrappers:
build-timeout: '20'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
scm:
- cord-infra-gerrit-repo-scm:
manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
branch: '$GERRIT_BRANCH'
destination-dir: 'cord'
node: 'ubuntu16.04-basebuild-1c-2g'
project-type: freestyle
concurrent: false
builders:
- cord-infra-gerrit-repo-patch:
destination-dir: 'cord'
project: '$GERRIT_PROJECT'
change-number: '$GERRIT_CHANGE_NUMBER'
patchset-number: '$GERRIT_PATCHSET_NUMBER'
- shell: |
#!/usr/bin/env bash
# checkout is under cord
cd cord
# make repos checkout directory
mkdir -p docs/repos
# Find path to the repo, copy into docs
PROJECT_PATH=$(xmllint --xpath "string(//project[@name=\"$GERRIT_PROJECT\"]/@path)" .repo/manifest.xml)
cp -r "$PROJECT_PATH" "docs/repos/$(basename $PROJECT_PATH)"
# build docs, don't touch checkout under test, capture test result
cd docs
SKIP_CHECKOUT="$GERRIT_PROJECT" make test
test_result=$?
# cleanup
make clean
exit $test_result
- job-template:
id: publish-documentation
name: 'publish-documentation'
triggers:
- gerrit:
server-name: '{gerrit-server-name}'
dependency-jobs: '{dependency-jobs}'
silent-start: true
trigger-on:
- change-merged-event
projects:
- project-compare-type: PLAIN
project-pattern: 'docs'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{all-files-regexp}'
- project-compare-type: REG_EXP
project-pattern: '{other-docs-repos-regexp}'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{doc-files-regexp}'
- compare-type: REG_EXP
pattern: '.*\.md'
properties:
- cord-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
wrappers:
- lf-infra-wrappers:
build-timeout: '20'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
scm:
- cord-infra-gerrit-repo-scm:
manifest-url: '{gerrit-server-url}/{cord-repo-manifest}'
branch: '$GERRIT_BRANCH'
destination-dir: 'cord'
node: 'ubuntu16.04-basebuild-1c-2g'
project-type: freestyle
concurrent: false
builders:
- shell: |
#!/usr/bin/env bash
set -e -o pipefail
# Set up the ssh host keys for the docs host
mkdir -p ~/.ssh
echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
# build gitbook docs
cd $WORKSPACE/cord/docs
make build
rsync -rvzh --delete _book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
# build swagger docs
cd $WORKSPACE/cord/orchestration/xos/docs
make swagger_docs
rsync -rvzh --delete swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH/swagger