Skip to content

Native options parser does not correctly interpolate pants_distdir if set in a sub config #22057

Open
@gniemann

Description

@gniemann

Describe the bug
We change the pants_distdir global option in a pants.ci.toml which is applied with --pants-config-files in CI. We do not set pants_distdir in our pants.toml and use the default value.

In pants.ci.toml:

[GLOBAL]
pants_distdir = "%(buildroot)s/dist.docker"

We also include [stats] in pants.ci.toml like so:

[stats]
log = true
output_file = "%(pants_distdir)s/stats.jsonl"
format = "jsonlines"

Note that the output_file interpolates pants_distdir.

This results in the following mismatch between the legacy and native options parser:
pants --pants-config-files=pants.ci.toml list :: > /dev/null

- Value mismatch for the option `output_file`:
    Legacy value: /Users/greg.niemann/Klaviyo/Repos/k-repo/dist.docker/stats.jsonl of type <class 'str'>, from source CONFIG
    Native value: /Users/greg.niemann/Klaviyo/Repos/k-repo/dist/stats.jsonl of type <class 'str'>, from source CONFIG

As of 2.24.2, this results in the stats file being written to dist and not dist.docker.
Note that the specialized pants_distdir (dist.docker) is used correctly by everything else. It is only this option.

Pants version
Which version of Pants are you using?
2.24.2

OS
Are you encountering the bug on MacOS, Linux, or both?
Both

Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions