Bit confused about the docs regarding `pants.ci.to...
# general
n
Bit confused about the docs regarding
pants.ci.toml
Then, in your CI script or config, set the environment variable
PANTS_CONFIG_FILES=pants.ci.toml
to use this new config file, in addition to
pants.toml
.
In my testing, i seem to need to specify
Copy code
PANTS_CONFIG_FILES="['pants.toml', 'pants.ci.toml']"
for the options to get merged
Actually I'm not sure what is going on. What I'm trying to achieve , in pant.toml
Copy code
[docker.registries.primary]
address = "<http://1111111.dkr.ecr.us-east-1.amazonaws.com|1111111.dkr.ecr.us-east-1.amazonaws.com>"
default = true
use_local_alias = true
extra_image_tags = [
"blah"
]
in pants.ci.toml
Copy code
[docker.registries.primary]
address = "<http://9999999.dkr.ecr.us-east-1.amazonaws.com|9999999.dkr.ecr.us-east-1.amazonaws.com>"
but without needing to also specify the other options in pants.ci.toml - but maybe this is not possible?
c
yea, that’s a tricky one. Looking at the docs for this particular option, it hints that the config is a dictionary one level above you configure for here (toml syntax kind of masks this fact), from `./pants docker --help`:
Copy code
--docker-registries="{'key1': val1, 'key2': val2, ...}"
So the value for your registries key
primary
gets replaced rather than merged. For this case, you’d need some other method of changing the address, like relying on an external env var could work:
Copy code
address = "%(env.DKR_ECR_ADDRESS)s"
Also note, that I think this issue was masking the pants toml files for you, as that seem to be working as documented. Observe this info:
Copy code
--docker-registries="{'key1': val1, 'key2': val2, ...}"
  PANTS_DOCKER_REGISTRIES
  registries
      default: {}
      current value: {...} (from pants.ci.toml, pants.toml)
(the “from …” part)
Copy code
PANTS_CONFIG_FILES=pants.ci.toml ./pants docker --help
n
Thanks! That's very helpful. Yes, that it was a dictionary was throwing me off.
✔️ 1
h
I had a change to merge dicts, I thought that went in
c
it did, haven’t played a lot with it, but I suppose it’s on top level only, not deep merge.
i.e. I tried
[docker.registries.primary.add] address = "foo"
but that didn’t work
maybe I placed the
.add
wrong.. ? 😉
h
Ah yes, definitely not deep