-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: healthcheck for docker container exit (#1464)
* Healthcheck for exited containers added; Fixed Network namings. * Update namings; Add pull skipping if image already exist, catch errors during image pulling to throw IntegrationCheckException and skip tests. * Remove alwaysPull; test if image is available under the docker user; handle pulling timeout properly to fail fast. * maybeSuspendEither * add autoPull option
- Loading branch information
Showing
14 changed files
with
245 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...amework-docker/src/main/scala/izumi/distage/docker/healthcheck/ContainerExitedCheck.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package izumi.distage.docker.healthcheck | ||
import izumi.distage.docker.Docker.ContainerState | ||
import izumi.distage.docker.healthcheck.ContainerHealthCheck.HealthCheckResult | ||
import izumi.distage.docker.{Docker, DockerContainer} | ||
import izumi.logstage.api.IzLogger | ||
|
||
final class ContainerExitedCheck[Tag](canBeDestroyed: Boolean) extends ContainerHealthCheck[Tag] { | ||
override def check(logger: IzLogger, container: DockerContainer[Tag], state: Docker.ContainerState): HealthCheckResult = { | ||
state match { | ||
case ContainerState.Running => | ||
logger.debug(s"$container still running, marked as unavailable.") | ||
HealthCheckResult.Bad | ||
case ContainerState.SuccessfullyExited => | ||
logger.debug(s"$container successfully exited, marked available.") | ||
HealthCheckResult.Good | ||
case ContainerState.NotFound if canBeDestroyed => | ||
logger.debug(s"$container was destroyed, marked available.") | ||
HealthCheckResult.Good | ||
case ContainerState.NotFound => | ||
HealthCheckResult.Terminated("Container not found.") | ||
case ContainerState.Failed(status) => | ||
HealthCheckResult.Terminated(s"Container terminated with non zero code. Code=$status") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.