summaryrefslogtreecommitdiffstats
path: root/jjb/opnfvdocs/docs-rtd.yaml
blob: a239b4e4b5f52be5dd96ad78e2ada1c32709b56b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
- project:
    name: docs-rtd
    jobs:
      - 'docs-merge-rtd-{stream}'
      - 'docs-verify-rtd-{stream}'

    stream:
      - master:
          branch: 'master'
      - fraser:
          branch: 'stable/{stream}'
      - danube:
          branch: 'stable/{stream}'
      - euphrates:
          branch: 'stable/{stream}'

    project: 'opnfvdocs'
    rtdproject: 'opnfv'
    # TODO: Archive Artifacts

- job-template:
    name: 'docs-merge-rtd-{stream}'

    project-type: freestyle

    parameters:
      - label:
          name: SLAVE_LABEL
          default: 'lf-build1'
          description: 'Slave label on Jenkins'
          all-nodes: false
          node-eligibility: 'ignore-offline'
      - project-parameter:
          project: '{project}'
          branch: '{branch}'

    triggers:
      - gerrit-trigger-change-merged:
          project: '**'
          branch: '{branch}'
          files: 'docs/**/*.*'

    builders:
      - 'remove-old-docs-from-opnfv-artifacts'
      - shell: |
          if [ $GERRIT_BRANCH == "master" ]; then
            RTD_BUILD_VERSION=latest
          else
            RTD_BUILD_VERSION=${{GERRIT_BRANCH/\//-}}
          fi
          curl -X POST --data "version_slug=$RTD_BUILD_VERSION" https://readthedocs.org/build/opnfvdocsdemo


- job-template:
    name: 'docs-verify-rtd-{stream}'

    project-type: freestyle

    parameters:
      - label:
          name: SLAVE_LABEL
          default: 'lf-build2'
          description: 'Slave label on Jenkins'
          all-nodes: false
          node-eligibility: 'ignore-offline'
      - project-parameter:
          project: '{project}'
          branch: '{branch}'
      - string:
          name: GIT_BASE
          default: https://gerrit.opnfv.org/gerrit/opnfvdocs
          description: 'Git URL to use on this Jenkins Slave'

    scm:
      - git-scm-with-submodules:
          branch: '{branch}'

    triggers:
      - gerrit-trigger-patchset-created:
          server: 'gerrit.opnfv.org'
          project: '**'
          branch: '{branch}'
          files: 'docs/**'

    builders:
      - shell: |
          if [ "$GERRIT_PROJECT" != "opnfvdocs" ]; then
              # Temporary hacky solution to handle local builds for projects
              # that already moved away from submodules
              if ! cd docs/submodules/$GERRIT_PROJECT 2 > /dev/null; then
                  rm -rf .* * 2 > /dev/null
                  git clone ${{GIT_BASE/opnfvdocs/$GERRIT_PROJECT}} .
              fi
              git fetch origin $GERRIT_REFSPEC && git checkout FETCH_HEAD
              cd -
          else
              git fetch origin $GERRIT_REFSPEC && git checkout FETCH_HEAD
          fi
          if [ -d docs/subdmodules ]; then
              for project in docs/submodules/*; do
                  cd $project && git submodule deinit -f . && cd -
              done
          fi
      - shell: |
          sudo -H pip install virtualenv
          virtualenv $WORKSPACE/venv
          . $WORKSPACE/venv/bin/activate
          pip install --upgrade pip
          pip freeze
          pip install tox
          sed -i s,\-b\ html,\-b\ singlehtml,g tox.ini
          tox -edocs
      - 'upload-review-docs'