-
Notifications
You must be signed in to change notification settings - Fork 8
fix: make app failed if a container is stopped #116
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
base: main
Are you sure you want to change the base?
Conversation
9be4ebb to
1bfe213
Compare
dc07a7f to
09691b6
Compare
|
we should think of some test for this |
| containerState: []container.ContainerState{container.StateRunning, container.StateDead, container.StateRemoving, container.StateRestarting, container.StateExited}, | ||
| want: StatusFailed, | ||
| }, | ||
| { |
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.
we should add a test for the new check
3db2a77 to
0243557
Compare
Co-authored-by: Luca Rinaldi <l.rinaldi@arduino.cc>
0243557 to
2549af2
Compare
2549af2 to
a09d652
Compare
internal/orchestrator/helpers.go
Outdated
| continue | ||
| } | ||
| if slices.ContainsFunc(s, func(v containerStateInfo) bool { | ||
| return v.State == StatusStopped && strings.Contains(v.StatusMessage, "Exited (0)") |
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.
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.
internal/orchestrator/helpers.go
Outdated
| } | ||
| appsStatusMap[appPath] = append(appsStatusMap[appPath], StatusFromDockerState(c.State)) | ||
| appsStatusMap[appPath] = append(appsStatusMap[appPath], containerStateInfo{ | ||
| State: StatusFromDockerState(c.State), |
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 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.
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.