<@U01PZK60W2F> not sure if you'd consider it a bug...
# general
a
@curved-television-6568 not sure if you'd consider it a bug. But I have multiple customers, and each of which have a creatively named
base
docker image (amongst other conflicting image names) the solution for this was change all their build/deploy scripts to name their docker images
<companyname>/base
or similar. Buuuut, I can't do that with the 2.7 pants
docker_image
target, because
/
is a disallowed target name. Is there a way to specify the image name of a
docker_image
target to be something other than the
name
property?
💯 1
h
Oh good point! @curved-television-6568 I'm about to head to bed but I wonder if OutputPathField from package.py would be applicable
a
Considered engaging some janky macro to prefix all the names with
<companyname>__
but 😬
c
It's next up to add a field for repo, and customizations for the name part.
❤️ 1
So yeah, bug/missing feature.
a
👍
c
With the latetst upcoming 2.8 dev, you can put the repo at the end of the registry address ad a hack..
a
I guess, another thing to consider. all our images are
Copy code
FROM <companyname>/base
but the container registry is
<http://eu.gcr.io/whatever/|eu.gcr.io/whatever/>...
which'd make tying the two together also problematic.
(fun fact: company #1s base image runs company #2s code 80% effectively. that was a fun day of debugging)
c
Yeah, we use this in ours (not supported in Pants, yet)
Copy code
ARG REGISTRY
FROM ${REGISTRY}/
… Where the build arg is picked up from env var. Will introduce something similar for Pants. Not sure what it will look like yet.
Oh, and thank you so much for the feedback. It is invaluable! :)
a
👍 happy to help.
c
@hundreds-father-404 I don't think OutputPath really applies, as it does not land on the fs directly, and the image name isn't really path-like either..
👍 1
a
docker images are so... half-baked. names, labels, tags, ids, registries, 😖
c
Speaking of Docker tags, I’m trying to decide whether to use the
tags
field for additional tags on the image, such as
"latest"
, or use a new field for that.. wdyt? I’m most concerned with how it would impact other goals/options, such as list and filter etc..
a
isn't the
tags
field used for things like target pruning?
which would mean:
./pants --tag=deployable publish ::
pushes
my_image:deployable
c
Yeah, so I think that
tags
is the perfect field name but perhaps not the best choice for that very reason..
👍 1
a
in my half-baked docker-build implementation anything associated with the image itself i've prefixed with
image_
i.e.
image_name
and
image_tags
c
That’s reasonable.
And so
image_name
could default to target name, if not specified…
a
yep
c
And for repo, I’m thinking of having a
[docker].default_repository
option, and support to optionally use a trailing part of the target address for repo, so you can re-use your directory structure for that purpose..
a
I think that checks out. But one thing to consider, and maybe I'm an edge-case. But I did build support for multiple-repositories because that's a use-case we have. Push everything to 'our' repositories. And then some customer libraries to a customer-exposed repository.
👍 1
could probably bodge that together in additional scripting, so maybe it's not that important. but something to consider, I'm probably not the only one out there.
c
I love edge cases. If you cover the edges well, everything else falls into place. 🙂
❤️ 1
Ah, right, so I just introduced the
registry
field, which in your case would better be
registries
, and tagging each accordingly then.. hmm.. Thanks for the heads up on that 🙂
a
we do the same with pypi too fyi
c
Yeah, I remember that part from your publish PR.. my head just wasn’t at that place then… 😛
a
ha
c
@ambitious-actor-36781 take a look at https://github.com/pantsbuild/pants/pull/13048. Hopefully, that will cover your docker image naming needs.
h
I definitely wouldn't use
tags
for that, as it has special meaning in Pants, as you noted.
image_tags
?
docker_tags
?
1
c
Yeah, went with
image_tags
, it’s in the PR 🙂
h
Hah, I'm working through the PRs in order, so I didn't see that one when I commented to that effect on the other one...
c
It’s fine 😛
I’m currently touching up on @ambitious-actor-36781 publish PR using FieldSets rather than a custom union. See if I have anything ready for tonight, otherwise tomorrow hopefully..