Skip to content

Commit

Permalink
Merge pull request #24359 from Honny1/startu-healthcheck-inspect
Browse files Browse the repository at this point in the history
Show Startup HealthCheck configuration with `podman inspect`
  • Loading branch information
openshift-merge-bot[bot] authored Oct 24, 2024
2 parents 70d5810 + afedb83 commit 2da21d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libpod/container_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ func (c *Container) generateInspectContainerConfig(spec *spec.Spec) *define.Insp
ctrConfig.StopSignal = signal.ToDockerFormat(c.config.StopSignal)
// TODO: should JSON deep copy this to ensure internal pointers don't
// leak.
ctrConfig.StartupHealthCheck = c.config.StartupHealthCheckConfig

ctrConfig.Healthcheck = c.config.HealthCheckConfig

ctrConfig.HealthcheckOnFailureAction = c.config.HealthCheckOnFailureAction.String()
Expand Down
2 changes: 2 additions & 0 deletions libpod/define/container_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type InspectContainerConfig struct {
Annotations map[string]string `json:"Annotations"`
// Container stop signal
StopSignal string `json:"StopSignal"`
// Configured startup healthcheck for the container
StartupHealthCheck *StartupHealthCheck `json:"StartupHealthCheck,omitempty"`
// Configured healthcheck for the container
Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"`
// HealthcheckOnFailureAction defines an action to take once the container turns unhealthy.
Expand Down
3 changes: 3 additions & 0 deletions test/system/220-healthcheck.bats
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ function _check_health {
run_podman inspect $ctrname --format "{{.Config.HealthcheckOnFailureAction}}"
is "$output" "kill" "on-failure action is set to kill"

run_podman inspect $ctrname --format "{{.Config.StartupHealthCheck.Test}}"
is "$output" "[CMD-SHELL /home/podman/healthcheck]" ".Config.StartupHealthCheck.Test"

current_time=$(date --iso-8601=ns)
# We can't check for 'starting' because a 1-second interval is too
# short; it could run healthcheck before we get to our first check.
Expand Down

1 comment on commit 2da21d1

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.