containertool: add --expose and --label flags - #177
Open
krishnapermi wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #88
Closes #90
Adds two new CLI flags to
containertool, addressing the feature requests in the parent issue #91.--expose <port>Marks a network port as exposed in the image's OCI configuration. The flag can be repeated. Bare numbers are normalised to the default
/tcpsuffix (--expose 8080->8080/tcp); explicit protocol suffixes are preserved as-is (8080/tcp,53/udp). New entries are merged with any ports already present in the base image.--label <key=value>Applies an OCI image label. Like
--expose, repeatable. Labels are merged with any already set by the base image; a--labelvalue wins on key collision. Entries that don't contain=are rejected at validation time with a clear error.Both flags follow the pattern established by
--env: declared inImageConfigurationOptionswithparsing: .singleValue, passed as typed parameters topublishContainerImage, and merged intoinheritedConfigurationbefore theImageConfigurationis assembled.I noticed these two issues while going through the open issue list after submitting #175. The OCI config schema already had
ExposedPortsandLabelsfields inSchema.swift- it was just a matter of wiring up the CLI surface and the merging logic.