-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Docker registries use_local_alias
configuration option.
#17265
Conversation
[ci skip-build-wheels] [ci skip-rust]
…ias instead as short name. + fix issue with build invocation from image run goal.
local_name
configuration option.run_as_alias
configuration option.
if registry.run_as_alias: | ||
# We only need to tag a single image name for run requests if there is a registry with | ||
# `run_as_alias` as true. | ||
build_request = replace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is arguably a little bit hackish, but we simply override the list of registries selected for the docker build field set in case of a run request to only include the registry alias as a hardcoded value, overriding any defaults or field values. Sneaky.
@thejcannon does this do what you wish it did? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example LGTM. I'll leave the implementation up to whoever to review.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! Couple of questions:
Should run_as_alias
be local_alias
? It may not be specific to the run
goal so much as to local operations more generally?
Could we just always generate and use this alias? Do we need the flag?
Thanks, I like that. 👍🏽
We could, yes. I was being a bit cautious in making this an opt-in feature. It could add up quite a few extra superfluous tags in case of multiple registries (although I don't know if that is a common thing or not). I'm fine either way.. |
Ah, that makes sense. So yeah, opt-in makes sense, and people can set with So the name should probably be |
Gotcha. I'll change to |
Ah right, this is on the registry. |
run_as_alias
configuration option.use_local_alias
configuration option.
Fixes #16354
If you run an Docker image locally, support using a shorter image name than the full registry url required when publishing the image, to keep the image names briefer in case of very long registry addresses (AWS cough cough)
When
./pants run <image target>
only the first registry with a "use_local_alias" defined on any of the applicable registries will be built and executed, while./pants package <image target>
always tags the built image with all image names, including the short ones.Example:
Where as when you package
myservice:img
, it would tag it with both the registry address, and the alias and forpublish
it would push only the image with the registry address.