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