Skip to content

How to handle environment variables? #164

@felixfontein

Description

@felixfontein

With semantic markup, we have E(...) to reference environment variables. For RST output, the Sphinx :envvar: role is used (https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-envvar). antsibull-docs uses the .. envvar:: directive (https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-envvar) for all environment variables that appear in env: plugin configs (and the Ansible/ansible-core docsite generates .. envvar:: directives for all ansible-core config values, see https://github.com/ansible/ansible/blob/devel/docs/templates/config.rst.j2#L223-L248). But for all other environment variables mentioned in text, there is no such (auto-generated) target.

So either collections define their own targets, which can cause problems if multiple collections define targets that end up in the Ansible docsite, or they don't, and we end up with a list of WARNING: 'envvar' reference target not found: warnings. A good example is ansible-collections/community.docker#645 with its output https://github.com/ansible-collections/community.docker/actions/runs/5235637304/jobs/9452611330.

This makes using E(...) inattractive or even outright impossible (for example in community.docker, the docsite build must have no errors for CI to pass). Manually defining .. envvar:: directives is not a good idea either (except in special cases). #75 would improve the situation a bit, but it won't happen anytime soon (core doesn't like it).

I'm opening this issue so we can discuss what to do about this. Having a huge amount of new reference errors in the docsite build is something I'm pretty sure nobody wants. Just muting all these warnings (the one for env vars, not the general reference errors) isn't a good idea either IMO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions