-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make the healthcheck flags compatible with Docker CLI #3508
Make the healthcheck flags compatible with Docker CLI #3508
Conversation
Hi @csomh. Thanks for your PR. I'm waiting for a containers or openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
cmd/podman/common.go
Outdated
createFlags.String( | ||
"health-cmd", "", | ||
"set a healthcheck command for the container ('none' disables the existing healthcheck)", | ||
) | ||
createFlags.String( | ||
"healthcheck-command", "", |
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.
I think Cobra allows aliases for flags - it'd be better to add these as aliases to the existing flags, not entirely new ones
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.
Can you point me to some docs, please? I've looked but could not find anything. This is why I've followed the same pattern that was used for the --net
, --network
pair.
(Cobra allows shorthands, as in --publish, -p
with StringP
, but that's not what is needed in this case.)
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.
I'm almost certain we used this somewhere... Let me poke around
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.
I might have been thinking of urfave/cli instead, which AFAIK allowed arbitrary numbers of flag aliases. Which, in cases like this, was a good bit more convenient...
/ok-to-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: csomh, mheon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cmd/podman/shared/create.go
Outdated
@@ -91,7 +91,11 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod. | |||
|
|||
var healthCheckCommandInput string | |||
// if the user disabled the healthcheck with "none", we skip adding it | |||
healthCheckCommandInput = c.String("healthcheck-command") | |||
healthCheckCommandInput = c.String("health-cmd") |
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.
I'd prefer we error here if both are set, instead of unconditionally overwriting
☔ The latest upstream changes (presumably #3517) made this pull request unmergeable. Please resolve the merge conflicts. |
Inside of cobra they explain how to do this. Example #2: You want to alias two flags. aka --old-flag-name == --new-flag-name func aliasNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
switch name {
case "old-flag-name":
name = "new-flag-name"
break
}
return pflag.NormalizedName(name)
}
myFlagSet.SetNormalizeFunc(aliasNormalizeFunc) |
Thanks @rhatdan! That's what I was looking for. I've updated the PR to use aliases instead. Varlink and GenericCLIResults were not changed, but I'm not entirely confident, that I understand those parts correctly, so let me know if those also need a change. |
Slight touchups needed on the manpages, otherwise LGTM |
@csomh Mind rebasing? There are fixes for test failures on master |
@mheon some are still failing. Would it make sense to rebase onto the latest green commit instead? |
Checking, let me see if we're looking at flakes or real failures |
|
I think we might have a real panic here |
Of course we had... un-did the changes in |
Last failure looks like a flake, restarted |
Command completions in contrib/bash/podman also need to be updated. |
Do you mean
I did not update completion with the Let me know if you think otherwise. |
docs/podman-create.1.md
Outdated
@@ -268,26 +268,26 @@ The following example maps uids 0-2000 in the container to the uids 30000-31999 | |||
|
|||
Add additional groups to run as | |||
|
|||
**--healthcheck-command**=*command* | |||
**--health-cmd**, **--healthcheck-command**=*command* |
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.
Can you just remove the old options, they should be gone now from --help, so no reason to document, as long as people using the old option continue to work, we don't need to document.
Good on the completions. I agree on not exposing --healthcheck* at all. Bottom line is remove it from being exposed anywhere but support it if a user used it within a script. |
Removed |
/retest |
☔ The latest upstream changes (presumably #3574) made this pull request unmergeable. Please resolve the merge conflicts. |
Signed-off-by: Hunor Csomortáni <[email protected]>
Docker CLI calls the healthcheck flags "--health-*", instead of "--healthcheck-*". Introduce the former, in order to keep compatibility, and alias the later, in order to avoid breaking current usage. Change "--healthcheck-*" to "--health-*" in the docs and tests. Signed-off-by: Hunor Csomortáni <[email protected]>
Signed-off-by: Hunor Csomortáni <[email protected]>
/retest |
Restarted them both - looked like known flakes |
LGTM |
LGTM and happy green test buttons. TYVM @csomh ! |
Merging |
Docker CLI calls the healthcheck flags
--health-*
, instead of--healthcheck-*
. Introduce the former, in order to keep compatibility,and alias the later, in order to avoid breaking current usage.
See discussion on #3455.