is there a way to select a container registry when...
# general
b
is there a way to select a container registry when doing
pants publish
or
pants package
? I have the following config in `pants.toml`:
Copy code
[docker.registries.myregistry]
address = "<http://myregistry.azurecr.io|myregistry.azurecr.io>"
default = true

[docker.registries.mysecondregistry]
address = "<http://mysecondregistry.azurecr.io|mysecondregistry.azurecr.io>"
Depending on the environment, I want to push to
mysecondregistry
instead of
myregistry
. I was thinking about having something like
pants --registry mysecondregistry publish ::
. Then I can alternate between them in CI. Both registries will be used in CI, so using a specific one in pants.ci.toml is not the case.
c
it’ll be with tweaking the configuration, either with local
.pants.rc
files or on the command line/env as there’s currently no flag that toggle registries by alias.
easiest if your targets rely on using the default registry, is to re-assign the default in the configuration
b
what should I output to
pants.rc
? Will it override
pants.ci.toml
?
c
I think the rc file is applied after PANTS_TOML_FILES, yes.
I think something like this ought to work:
Copy code
[docker.registries.myregistry.add]
default = false

[docker.registries.mysecondregistry.add]
default = true
ah, there’s also a
skip_push
option for registries you could use
b
would making a pants.ci.alternative.toml with this content and running
pants --pants-config-files="['<buildroot>/pants.ci.alternative.toml']" publish ::
solve?
c
so, you could have all images use all registries, and then selectively set
skip_push=False
for the ones you want to push to, for instance.
try it, I would be guessing 😉
but my hunch is, yes that ought to work 😉
g
Can you use
parametrize
on the
docker_image.registries
field? I'd also consider macros+tags if that doesn't work.