Skip to content

Conversation

@giulio93
Copy link
Contributor

@giulio93 giulio93 commented Nov 27, 2025

Motivation

If at least a container of an application is stopped due to any reason, the application status should be failed.
In this way even if other containers are up and running the state of the application state is set as failed, and the user can debug the failed container.

@giulio93 giulio93 requested a review from lucarin91 November 27, 2025 13:21
@giulio93 giulio93 force-pushed the add_stopped_state_to_app_status branch 2 times, most recently from 9be4ebb to 1bfe213 Compare November 27, 2025 13:23
@giulio93 giulio93 force-pushed the add_stopped_state_to_app_status branch 5 times, most recently from dc07a7f to 09691b6 Compare November 28, 2025 08:36
@lucarin91
Copy link
Contributor

we should think of some test for this

@lucarin91 lucarin91 changed the title Add status stopped in container list app status fix: make app failed if a container is stopped Nov 28, 2025
containerState: []container.ContainerState{container.StateRunning, container.StateDead, container.StateRemoving, container.StateRestarting, container.StateExited},
want: StatusFailed,
},
{
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add a test for the new check

@giulio93 giulio93 force-pushed the add_stopped_state_to_app_status branch from 3db2a77 to 0243557 Compare November 28, 2025 09:13
giulio93 and others added 2 commits December 5, 2025 12:35
Co-authored-by: Luca Rinaldi <l.rinaldi@arduino.cc>
@giulio93 giulio93 force-pushed the add_stopped_state_to_app_status branch from 0243557 to 2549af2 Compare December 5, 2025 11:37
@giulio93 giulio93 force-pushed the add_stopped_state_to_app_status branch from 2549af2 to a09d652 Compare December 5, 2025 15:02
continue
}
if slices.ContainsFunc(s, func(v containerStateInfo) bool {
return v.State == StatusStopped && strings.Contains(v.StatusMessage, "Exited (0)")
Copy link
Contributor

@lucarin91 lucarin91 Dec 5, 2025

Choose a reason for hiding this comment

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

We should account for all exit codes that aren't signals, so everything that is less than 128

If you write an app with Python-like

exit(1)

You say that this isn't a fail, which in fact it is, because the app exits right after be started.

}
appsStatusMap[appPath] = append(appsStatusMap[appPath], StatusFromDockerState(c.State))
appsStatusMap[appPath] = append(appsStatusMap[appPath], containerStateInfo{
State: StatusFromDockerState(c.State),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you update this mapping function and don't account for the status message there? If a container exited with anything that isn't 128 + 9 we could consider that a failing state, because it means that the process exited without Docker killing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants