@@ -1127,9 +1127,13 @@ func (u *upRunner) setAppMaxObservedPodStatus(app *app, s podStatus) {
11271127 switch {
11281128 case s == podStatusStarted :
11291129 app .reporterRow .AddStatus (reporter .StatusRunning )
1130- case s > = podStatusReady :
1130+ case s = = podStatusReady :
11311131 app .reporterRow .RemoveStatus (reporter .StatusRunning )
11321132 app .reporterRow .AddStatus (reporter .StatusReady )
1133+ case s >= podStatusCompleted :
1134+ app .reporterRow .RemoveStatus (reporter .StatusRunning )
1135+ app .reporterRow .RemoveStatus (reporter .StatusReady )
1136+ app .reporterRow .AddStatus (reporter .StatusCompleted )
11331137 }
11341138 }
11351139 app .newLogEntry ().Debugf ("pod status %s" , & app .maxObservedPodStatus )
@@ -1159,14 +1163,20 @@ func (u *upRunner) createPodsIfNeeded() error {
11591163 for name , healthiness := range app1 .composeService .DockerComposeService .DependsOn {
11601164 composeService := u .cfg .Services [name ]
11611165 app2 := u .apps [composeService .Name ()]
1162- if healthiness == dockerComposeConfig .ServiceHealthy {
1166+ switch healthiness {
1167+ case dockerComposeConfig .ServiceHealthy :
11631168 if app2 .maxObservedPodStatus != podStatusReady {
11641169 createPod = false
11651170 }
1166- } else {
1171+ case dockerComposeConfig . ServiceStarted :
11671172 if app2 .maxObservedPodStatus != podStatusStarted && app2 .maxObservedPodStatus != podStatusReady {
11681173 createPod = false
11691174 }
1175+ case dockerComposeConfig .ServiceCompletedSuccessfully :
1176+ // Note the assumption here is made that podStatusCompleted implies successfully. PRs welcome.
1177+ if app2 .maxObservedPodStatus != podStatusCompleted {
1178+ createPod = false
1179+ }
11701180 }
11711181 }
11721182 if createPod {
@@ -1190,10 +1200,13 @@ func (u *upRunner) formatCreatePodReason(app1 *app) string {
11901200 reason .WriteString (", " )
11911201 }
11921202 reason .WriteString (name )
1193- if healthiness == dockerComposeConfig .ServiceHealthy {
1194- reason .WriteString (": ready" )
1195- } else {
1203+ switch healthiness {
1204+ case dockerComposeConfig .ServiceStarted :
11961205 reason .WriteString (": running" )
1206+ case dockerComposeConfig .ServiceHealthy :
1207+ reason .WriteString (": ready" )
1208+ case dockerComposeConfig .ServiceCompletedSuccessfully :
1209+ reason .WriteString (": completed" )
11971210 }
11981211 comma = true
11991212 }
0 commit comments