(Docker backend) Does `{pants.hash}` interpolated ...
# general
b
(Docker backend) Does
{pants.hash}
interpolated value work in
extra_build_args
? The code and docs suggest so, but dumping the sandbox I see
Copy code
--build-arg $'INPUT_HASH={pants.hash}'
👀 1
Using
extra_build_args=["INPUT_HASH={pants.hash}"],
Hmm same if I use:
Copy code
[docker]
build_args = ["PANTS_HASH={pants.hash}"]
c
Please point to where this suggests to be working for
extra_build_args
.. as the docs, although subtle I grant you that, does not say it is supported. Note the difference for these two field docs:
extra_build_args
type:
Iterable[str] | None
default:
()
Build arguments (
--build-arg
) to use when building this image. Entries are either strings in the form
ARG_NAME=value
to set an explicit value; or just
ARG_NAME
to copy the value from Pants’s own environment.
Use
[docker].build_args
to set default build args for all images.
image_tags
type:
Iterable[str] | None
default:
('latest',)
Any tags to apply to the Docker image name (the version is usually applied as a tag).
tag may use placeholders in curly braces to be interpolated. The placeholders are derived from various sources, such as the Dockerfile instructions and build args.
See Tagging Docker images.
(only one of them mentions placeholders…)
could make sense to extend this to cover more fields
b
https://www.pantsbuild.org/docs/tagging-docker-images#string-interpolation-using-placeholder-values
As we've seen above, some fields of the
docker_image
support replacing placeholder values in curly braces with variable text, such as a build arg or base image tag for instance.
Specifically "build arg" Followed by:
These are the common values available for all fields:
c
cool, that’s a doc-fart. 😛
b
OHHH I'm misreading. It's saying the value would be the build arg or tag, not that the build args or tags support interpolation
c
oh, yea
this
> These are the common values available for all fields:
ought to read
These are the common values available for all fields that support placeholders:
b
Well glad my fart found another fart
😅 1
c
still, I don’t recall why this is not applied to all fields..