feat: add separate server image tags ( #673)#706
Conversation
Signed-off-by: Mihir Dixit <dixitmihir1@gmail.com>
Signed-off-by: Mihir Dixit <dixitmihir1@gmail.com>
Signed-off-by: Mihir Dixit<dixitmihir1@gmail.com>
Signed-off-by : Mihir Dixit <dixitmihir1@gmail.com>
cbosdo
left a comment
There was a problem hiding this comment.
I believe that the new image tags handling is brittle…
Signed-off-by: Mihir Dixit<dixitmihir1@gmail.com>
|
@cbosdo Thanks for the guidance! I have addressed all your feedback: Refactor: I removed the manual flag shuffling in install.go and now rely on the mapstructure tags as you suggested. Cleanup: I removed the verbose comments in cmd_utils.go and install.go. Conflicts: I have resolved the conflicts with the recent refactor in main. Regarding Squashing: Since I am working through the Web UI to ensure valid GPG signatures (due to local environment restrictions), I cannot easily squash these commits locally without breaking the signatures. Could you please use the "Squash and Merge" option when merging this PR? Ready for final review! |
|
|
cbosdo
left a comment
There was a problem hiding this comment.
This PR changes a crucial part of the logic (the image URLs computation) and there is no unit test added or adjusted. This looks really strange.
| } | ||
|
|
||
| // If the alias "install podman" is used, "podman" will be the first arg. | ||
| // We remove it from the args slice so it isn't treated as the FQDN. |
There was a problem hiding this comment.
Why are you removing this valuable comment? I wonder how much of this PR has been generated by an AI…
| _ = utils.AddFlagHelpGroup(cmd, &utils.Group{ID: "image", Title: L("Image Flags")}) | ||
| _ = utils.AddFlagToHelpGroupID(cmd, "image", "image") | ||
| _ = utils.AddFlagToHelpGroupID(cmd, "tag", "image") | ||
| // without group, since this flag is applied to all the images |
There was a problem hiding this comment.
Why removing that comment: it explains why there is no group on those flags…
| Name string `mapstructure:"server-image"` | ||
| Tag string `mapstructure:"server-tag"` |
There was a problem hiding this comment.
These flags should go in the ServerFlags rather than this podman-specific struct. Someday we may remove this relic from a not so far future, but avoid mixing them for now.
|
@cbosdo Acknowledged — I'm working through all the review feedback carefully. Will push the fixes once everything is properly addressed. |
Add --server-image and --server-tag flags so users can pin the server container image independently of the global --image and --tag flags, which apply to all containers (coco, pgsql, saline, etc.). - Add ServerImageFlags struct and Server field to ServerFlags; viper maps --server-image to server.image and --server-tag to server.tag - Add AddServerImageFlags() in cmd_utils.go, called from AddServerFlags() - Wire the override in getFlagsUpdater (install) and the inline updater (upgrade): Server.Image -> Image.Name, Server.Tag -> Image.Tag - Move Name/Tag out of PodmanFlags; they belong in ServerFlags - Restore deleted comment and help group lines in cmd_utils.go - Restore deleted comment in install.go RunE - Add AssertServerImageFlags test helper and ServerImageOnlyFlagsTestArgs with distinct values to verify the override chain actually runs Signed-off-by: Mihir Dixit <dixitmihir1@gmail.com>
|







Fixes #673
Problem
The
--imageand--tagflags apply to all containers equally, making it impossible to pin the server container to a specific image or tag without affecting other containers (coco, pgsql, saline, etc.).Solution
Introduce two new server-specific flags:
--server-image: overrides the server container image name--server-tag: overrides the tag for the server container only; falls back to the global--tagif not providedChanges
mgradm/shared/utils/flags.go: AddedServerImageFlagsstruct toServerFlags; viper maps--server-image→server.imageand--server-tag→server.tag, following the same pattern as other container flagsmgradm/shared/utils/cmd_utils.go: AddedAddServerImageFlags(), called fromAddServerFlags()so the flags are available for install, upgrade and migration. Restored deleted comment explaining why some flags have no help groupmgradm/cmd/install/install.go: Wired the override ingetFlagsUpdater— ifServer.ImageorServer.Tagis set, it takes overImage.Name/Image.Tagrespectively. Restored deleted comment on the podman alias args handlingshared/podman/utils.go: RemovedName/Tagfields fromPodmanFlagswhere they did not belongServerImageOnlyFlagsTestArgsandAssertServerImageFlagscovering the full override chain with distinct values, so the test genuinely fails if the wiring is broken. Updatedmgradm_install.goandserver.gotest helpers accordinglyTesting
--server-imageand--server-tagappear correctly inmgradm install --help--server-image custom/servercorrectly populatesImage.Name, independently of--image--server-tagis not provided, the global--tagvalue is used