Skip to content

Commit

Permalink
Merge pull request #64 from avast/DontAcceptUnhealtyStatus
Browse files Browse the repository at this point in the history
Don't accept unhealthy state Fixes #63
  • Loading branch information
augi authored Mar 15, 2017
2 parents 5ed9217 + e567e4f commit c76076d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,19 @@ class ComposeUp extends DefaultTask {
Map<String, Object> inspectionState = getDockerInspection(service.getContainerId()).State
if (inspectionState.containsKey('Health')) {
String healthStatus = inspectionState.Health.Status
if (!"starting".equalsIgnoreCase(healthStatus)) {
if (!"starting".equalsIgnoreCase(healthStatus) && !"unhealthy".equalsIgnoreCase(healthStatus)) {
logger.lifecycle("${service.name} health state reported as '$healthStatus' - continuing...")
return
}
logger.lifecycle("Waiting for ${service.name} to become healthy (it's $healthStatus)")
sleep(extension.waitAfterHealthyStateProbeFailure.toMillis())
} else {
logger.debug("Service ${service.name} or this version of Docker doesn't support healtchecks")
return
}
if (start.plus(extension.waitForHealthyStateTimeout) < Instant.now()) {
throw new RuntimeException("Container ${service.containerId} of service ${service.name} is still reported as 'starting'. Logs:${System.lineSeparator()}${getServiceLogs(service.name)}")
}
logger.lifecycle("Waiting for ${service.name} to become healthy")
sleep(extension.waitAfterHealthyStateProbeFailure.toMillis())
}
}
}
Expand Down

0 comments on commit c76076d

Please sign in to comment.