Integrasi berkelanjutan/Pembuatan dokumentasi

This page is a translated version of the page Continuous integration/Documentation generation and the translation is 100% complete.

Dokumentasi dibuat secara otomatis dan diterbitkan ke Untuk meningkatkan fleksibilitas dan keamanan, situs statis bisa dibuat di dalam contoh-contoh WMCS. The docs are then fetched from the instance to the CI production host, and pushed with rsync to the documentation host (doc.discovery.wmnet as of March 2022). Halaman ini mendokumentasikan aliran kerjanya, bagian dari implementasi teknisnya, dan cara mendefinisikan pekerjaan baru.


Our Zuul layout reacts on two kinds of Gerrit events which are matched by two different pipelines:

Kejadian Gerrit Saluran pipa Zuul Deskripsi
change-merged postmerge Ketika perubahan digabungkan oleh Gerrit
ref-updated publish Referensi diubah (tip perubahan cabang, modifikasi tag)

ref-updated could cover the changes being merged since the target branch is updated, but the event is not associated with a Gerrit change number which prevents us from reporting back to the Gerrit interface. We thus use:

  • postmerge pipeline to report back in Gerrit so the user knows the documentation has been generated
  • publish pipeline which solely handles references updates matching ^refs/tags/.

In both cases, (change-merged or ref-updated) we trigger the same job to generate the documentation for any branch or tag. We thus need to namespace the documentation under based on the branch name or the tag name. The information is carried differently between events and the reference is slightly different between branch updates and tags. The conversion logic is carried by a Zuul python function which is applied to all the publish jobs. It injects to the Gearman function (and thus the Jenkins job environment) a variable DOC_SUBPATH which represents the version.


  • A change merged on REL1_35 branch: DOC_SUBPATH = REL1_35
  • refs/tags/1.35.0 updated: DOC_SUBPATH = 1.35.0

Reference: Gerrit change 173049

We can thus reuse that DOC_SUBPATH parameter to easily namespace the jobs per version. As an example, has documentation for both release branches ( and tags (

Jenkins job builder definitions

Most of the logic is defined in Jenkins Job Builder jjb/publish.yaml configuration file.

In a job definition, a builder defines what steps to execute. We provide a builder macro called doc-publish that takes care of transferring the generated files to the web server of It takes two parameters:

  1. docsrc Directory holding documentation files relative to workspace (without trailing slash)
  2. docdest Directory under

Example job definition:

# Typical PHP project
- job-template:
  name: myproject-publish
   - doxygen
   - doc-publish:
      docsrc: 'doc/html'
      docdest: myproject

# Typical JS project
- job-template:
  name: myproject-publish
   - jsduck
   - doc-publish:
      docsrc: 'docs'
      docdest: myproject

This will invoke the build scripts (doxygen and jsduck) and publish their results (respectively in doc/html and docs) to

To namespace the documentation based on project version, use the Zuul-generated DOC_SUBPATH (derived from branch or tag name). Simply insert it in the docdest parameter. You will need to invoke the builder assert-env-doc_subpath. Example for MediaWiki (mediawiki-core-doxygen-publish job):

- job:
    name: 'mediawiki-core-doxygen-publish'
     - assert-env-doc_subpath
     - zuul-cloner:
         projects: >
     # Build the documentation under /build/doc
     - shell: |
         rm -rf build/doc
         mkdir -p build/doc
         TARGET_BASEDIR="$WORKSPACE/build/doc" /srv/deployment/integration/slave-scripts/tools/
     # Publish from build/doc to mediawiki-core/$DOC_SUBPATH/php'
     - doc-publish:
         docsrc: 'build/doc'
         docdest: 'mediawiki-core/$DOC_SUBPATH/php'

This publishes the documentation at, and also publishes release branch documentation such as, and tagged releases such as


For architecture overview and runbooks, see

See also

  • Continuous integration/Entry points describes the conventions for extension automation. If you follow these when developing your extension, then (with a lot of CI wizardry), tests run and documentation generates "automagically".