b4b85f6a0a9655e908cc3f62d1f9306b5900dd34
[releng.git] / jjb / opnfvdocs / docs-rtd.yaml
1 ---
2 - project:
3     name: docs-rtd
4     jobs:
5       - 'docs-merge-rtd-{stream}'
6       - 'docs-verify-rtd-{stream}'
7
8     stream:
9       - master:
10           branch: 'master'
11       - gambia:
12           branch: 'stable/{stream}'
13       - fraser:
14           branch: 'stable/{stream}'
15       - danube:
16           branch: 'stable/{stream}'
17
18     project: 'opnfvdocs'
19     rtdproject: 'opnfv'
20     # TODO: Archive Artifacts
21
22 - job-template:
23     name: 'docs-merge-rtd-{stream}'
24
25     project-type: freestyle
26
27     parameters:
28       - label:
29           name: SLAVE_LABEL
30           default: 'lf-build1'
31           description: 'Slave label on Jenkins'
32           all-nodes: false
33           node-eligibility: 'ignore-offline'
34       - project-parameter:
35           project: '{project}'
36           branch: '{branch}'
37
38     triggers:
39       - gerrit-trigger-change-merged:
40           project: '**'
41           branch: '{branch}'
42           files: 'docs/**/*.*'
43
44     builders:
45       - 'remove-old-docs-from-opnfv-artifacts'
46       - shell: |
47           if [ $GERRIT_BRANCH == "master" ]; then
48             RTD_BUILD_VERSION=latest
49           else
50             RTD_BUILD_VERSION=${{GERRIT_BRANCH/\//-}}
51           fi
52           curl -X POST --data "version_slug=$RTD_BUILD_VERSION" https://readthedocs.org/build/opnfvdocsdemo
53
54
55 - job-template:
56     name: 'docs-verify-rtd-{stream}'
57
58     project-type: freestyle
59
60     parameters:
61       - label:
62           name: SLAVE_LABEL
63           default: 'lf-build2'
64           description: 'Slave label on Jenkins'
65           all-nodes: false
66           node-eligibility: 'ignore-offline'
67       - project-parameter:
68           project: '{project}'
69           branch: '{branch}'
70       - string:
71           name: GIT_BASE
72           default: https://gerrit.opnfv.org/gerrit/opnfvdocs
73           description: 'Git URL to use on this Jenkins Slave'
74
75     scm:
76       - git-scm-with-submodules:
77           branch: '{branch}'
78
79     triggers:
80       - gerrit-trigger-patchset-created:
81           server: 'gerrit.opnfv.org'
82           project: '**'
83           branch: '{branch}'
84           files: 'docs/**'
85
86     builders:
87       - shell: |
88           if [ "$GERRIT_PROJECT" != "opnfvdocs" ]; then
89               # Temporary hacky solution to handle local builds for projects
90               # that already moved away from submodules
91               if ! cd docs/submodules/$GERRIT_PROJECT 2 > /dev/null; then
92                   rm -rf .* * 2 > /dev/null
93                   git clone ${{GIT_BASE/opnfvdocs/$GERRIT_PROJECT}} .
94               fi
95               git fetch origin $GERRIT_REFSPEC && git checkout FETCH_HEAD
96               cd -
97           else
98               git fetch origin $GERRIT_REFSPEC && git checkout FETCH_HEAD
99           fi
100           if [ -d docs/subdmodules ]; then
101               for project in docs/submodules/*; do
102                   cd $project && git submodule deinit -f . && cd -
103               done
104           fi
105       - shell: |
106           sudo -H pip install virtualenv
107           virtualenv $WORKSPACE/venv
108           . $WORKSPACE/venv/bin/activate
109           pip install --upgrade pip
110           pip freeze
111           pip install tox
112           sed -i s,\-b\ html,\-b\ singlehtml,g tox.ini
113           tox -edocs
114       - 'upload-review-docs'