-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Return nil health when inspecting containers without healthchecks #21388
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ashley-cui 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 |
Fixes: #18792 |
Cockpit tests failed for commit 14e979d. @martinpitt, @jelly, @mvollmer please check. |
14e979d
to
2a936bc
Compare
Cockpit tests failed for commit 2a936bc. @martinpitt, @jelly, @mvollmer please check. |
2a936bc
to
29e4694
Compare
Cockpit tests failed for commit 29e4694. @martinpitt, @jelly, @mvollmer please check. |
@ashley-cui looks like you might have upset other tests. |
29e4694
to
5ab50ce
Compare
9390d56
to
8e8f3fc
Compare
Cockpit tests failed for commit 5ab50ce. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 9390d56. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 5ab50ce. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 8e8f3fc. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 9390d56. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 8e8f3fc. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 5ab50ce. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 9390d56. @martinpitt, @jelly, @mvollmer please check. |
Cockpit tests failed for commit 8e8f3fc. @martinpitt, @jelly, @mvollmer please check. |
libpod/container_inspect.go
Outdated
if reflect.DeepEqual(healthCheckState, define.HealthCheckResults{}) { | ||
data.State.Health = &healthCheckState | ||
} | ||
data.State.Health = nil |
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 looks wrong, you set it and then unset it. Should this be in a else statement?
8e8f3fc
to
1546f27
Compare
Cockpit tests failed for commit 1546f27. @martinpitt, @jelly, @mvollmer please check. |
containers/podman#21388 drops the `State.Health` field for containers without health checks. This causes an `undefined` crash in the container sort function.
Thanks, the latest round looks much greener. This still causes a crash in cockpit-podman due to the API change. I sent cockpit-project/cockpit-podman#1540 to adjust for this, it should land by tomorrow European morning. It would be nice if you could wait with landing this PR until then, so that we can re-run the test here and make sure everything is ok. FTR: This is exactly how I wanted the process to work -- we collaborate early and instantly know what/where things changed, before landing regressions in releases and distros 👍 ⭐ Thanks at this point! |
containers/podman#21388 drops the `State.Health` field for containers without health checks. This causes an `undefined` crash in the container sort function.
LGTM |
@containers/podman-maintainers PTAL |
|
||
for _, item := range log { | ||
res := &types.HealthcheckResult{} | ||
s, _ := time.Parse(time.RFC3339Nano, item.Start) |
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.
if you are comfy with ignoring this error, i would appreciate a comment here ... also ignored on the next line
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.
Fixed, the error is now handled. Thanks!
one nit, lets wait for @martinpitt before merging ... else, LGTM |
The cockpit PR landed, can you please retry (or force-push)? Thanks!
|
libpod/container_inspect.go
Outdated
@@ -196,7 +197,11 @@ func (c *Container) getContainerInspectData(size bool, driverData *define.Driver | |||
// An error here is not considered fatal; no health state will be displayed | |||
logrus.Error(err) | |||
} else { | |||
data.State.Health = healthCheckState | |||
if reflect.DeepEqual(healthCheckState, define.HealthCheckResults{}) { |
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.
why are we using DeepEqual here? first it slow but second we already are checking if there is healthcheck with
c.config.HealthCheckConfig != nil
so we should just assign the struct here.
The health key should only be missing if there is no healthcheck but not when the log is just empty (like it is doing here)
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.
Nice catch, thanks!
14d5626
to
4ce2a10
Compare
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.
LGTM
LGTM |
/lgtm |
Tests are angry |
On the surface, the changes LGTM, but tests are angry and this looks like it might be a real test issue:
|
When inspecting a container that does not define any health check, the health field should return nil. This matches docker behavior. Signed-off-by: Ashley Cui <acui@redhat.com>
4ce2a10
to
a1c47f0
Compare
Cockpit tests failed for commit a1c47f0. @martinpitt, @jelly, @mvollmer please check. |
Wrt. the rawhide failure, the test instaled the wrong cockpit-podman version again (from rawhide, instead of from our main-builds COPR). I'll investigate today, please disregard this ATM. I filed cockpit-project/cockpit-podman#1543 to fix this. |
@ashley-cui the rawhide cockpit-revdeps should go green now, I landed a fix/hack. I can't retry it myself, but you should be able to on https://github.com/containers/podman/pull/21388/checks?check_run_id=21048234276 |
/lgtm |
1698fa0
into
containers:main
When inspecting a container that does not define any health check, the health field should return nil. This matches docker behavior.
Does this PR introduce a user-facing change?