Building documentation

Clone a repository first

Before building documentation, you must first clone the repository where the files reside.

For the instructions on how to clone a repository so that you can work on it locally, refer to the Starting Work on a New Project of the Infrastructure manual.

See Troubleshooting your setup if you have difficulty with a repository setup.

Refer to Writing documentation for details on how to create content and contribute to the documentation.

Building output locally

Although you can use Linux, MacOS, or Windows to build locally the Sphinx documentation for OpenStack, Linux is the preferred build environment as it offers the most complete support for documentation building.

OpenStack project and documentation repositories use a tox.ini file with specific sections that run jobs using the Tox tool, a virtualenv-based automation of test activities.

Install dependencies for building documentation

OpenStack maintains a tool called bindep that maintains a list of dependencies for Linux package managers. When you run the tox -e bindep command, read the error messages and install the dependencies based on the error messages returned. Continue to run until your local environment meets the requirements as listed in bindep.txt in the repository.

Important

Ensure you run bindep in each individual project repository that you clone if you want to build the documentation.

For more information on bindep and packages, see Package Requirements.

  • On Ubuntu or Debian:

    # apt-get install python-pip
    # pip install tox
    $ tox -e bindep
    # apt-get install <indicated missing package names>
    
  • On RHEL or CentOS (replace yum with dnf on Fedora):

    # yum install python-pip
    # pip install tox
    $ tox -e bindep
    # yum install <indicated missing package names>
    
  • On openSUSE or SUSE Linux Enterprise:

    # zypper in python-pip
    # pip install tox
    $ tox -e bindep
    # zypper in <indicated missing package names>
    

Note

Running these commands will install all required packages for building both RST and PDF files. If you do not build PDF files, you do not need to install the texlive packages and Liberation font family.

  • On MacOS

    Open a Terminal window. Make sure you have Python installed. Many contributors use the Homebrew tool instructions.

    $ brew install python
    $ pip install tox
    

    Note

    You cannot run tox -e bindep on Mac OS X as it uses a Linux tool to parse the information. Issue logged here.

  • On Windows

    To the doc build scripts as-is on Windows, first install Git for Windows. Make sure you have a working Python environment, and then use Git Bash to run all tox commands within the repository directory:

    $ pip install tox
    

Build workflow for openstack-manuals

Once Tox is installed and configured, execute tox -e <jobname> to run a particular job. For example, to build all guides in openstack-manuals, run the following command:

$ tox -e docs

The individual Tox jobs you can run are explained in detail in the README file in the repository.

As a part of the review process, the OpenStack CI system runs scripts to check that the patch is fine. Locally, you can use the Tox tool to ensure that a patch works. To check all guides, run the tox command from the base directory of repository.

Build workflow for other repositories with documentation

Once Tox is installed and configured, execute the following command to run the docs job:

$ tox -e docs

When the build is finished, it outputs the built documentation to the doc/build directory. You can open the built .html files in a browser to review them.

Build an existing patch locally

To build a patch locally:

  1. In your clone of the appropriate repository, create a local branch that contains the particular patch.

    $ git review -d PATCH_ID
    

    Where the value of PATCH_ID is a Gerrit commit number. You can find this number on the patch link, https://review.opendev.org/#/c/PATCH_ID.

  2. Build the documentation affected by changes in the patch set. For more information, see Build workflow for openstack-manuals and Build workflow for other repositories with documentation.

Build jobs

The build jobs for documentation are stored in the project-config repository. The build jobs build to the docs.openstack.org and developer.openstack.org sites, copying built files via FTP.

The release-specific guides are built for the currently supported branches (current and previous releases), development happens on the master branch. The continuously released guides are only built on the master branch.

Like other projects, the documentation projects use a number of jobs that do automatic testing of patches.

For openstack-manuals, the current jobs are:

  • openstack-tox-linters

  • build-tox-manual-publishdocs

  • build-tox-manual-publishlang

Publishlang job

We only gate on manual/language combinations that are translated sufficiently.

  • If an import from Zanata fails, we do not approve the import.

  • If any other patch fails, the failure might get ignored.

  • In any case of failure, a bug gets reported against the i18n project.

If you want to manually run this check in your clone of openstack-manuals, use the publishlang environment (tox -e publishlang).

Building docs from end-of-life releases

OpenStack projects can follow different release models. The openstack-manuals repo follows two of these models, independent and cycle-with-milestones.

Note

The docs repo and the api-site follow the independent release model.

To build documentation from a particular release locally, follow these steps.

  1. In your clone of the appropriate repository, view the remote tags to see the tags for each release:

    $ git tag -l
    2012.1
    2012.2
    2013.1.rc1
    2013.1.rc2
    2013.2
    diablo-eol
    essex-eol
    folsom-eol
    grizzly-eol
    havana-eol
    icehouse-eol
    juno-eol
    kilo-eol
    liberty-eol
    
  2. Look for the release name you want to build, such as Essex, and check out the corresponding tag:

    $ git checkout essex-eol
    

    Git checks out the files and when complete, shows you the reference point for your local files, such as, HEAD is now at e6b9f61... fix delay_auth_decision parameter.

  3. Read the README.rst file available at that point in time for the prerequisites for building the documentation locally. For example, you may need to install Apache Maven in order to build old documents.