diff --git a/README.md b/README.md index 0c1519e5..b97d90bb 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ dockerCompose { downAdditionalArgs = ['--some-switch'] waitForTcpPorts = true // turns off the waiting for exposed TCP ports opening + tcpPortsToIgnoreWhenWaiting = [1234] // list of TCP ports what will be ignored when waiting for exposed TCP ports opening; default: empty list captureContainersOutput = false // if true, prints output of all containers to Gradle output - very useful for debugging; default is false captureContainersOutputToFile = '/path/to/logFile' // sends output of all containers to a log file composeLogToFile = project.file('build/my-logs.txt') // redirect output of composeUp and composeDown tasks to this file; default is null (ouput is not redirected) diff --git a/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy b/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy index a3c60543..5349831b 100644 --- a/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy +++ b/src/main/groovy/com/avast/gradle/dockercompose/ComposeSettings.groovy @@ -35,6 +35,7 @@ class ComposeSettings { boolean buildBeforeUp = true boolean buildBeforePull = true boolean waitForTcpPorts = true + List tcpPortsToIgnoreWhenWaiting = [] Duration waitAfterTcpProbeFailure = Duration.ofSeconds(1) Duration waitForTcpPortsTimeout = Duration.ofMinutes(15) Duration waitForTcpPortsDisconnectionProbeTimeout = Duration.ofMillis(1000) diff --git a/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy b/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy index d275fa72..add95294 100644 --- a/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy +++ b/src/main/groovy/com/avast/gradle/dockercompose/tasks/ComposeUp.groovy @@ -157,7 +157,9 @@ class ComposeUp extends DefaultTask { def start = Instant.now() servicesInfos.forEach { serviceInfo -> serviceInfo.containerInfos.each { instanceName, containerInfo -> - containerInfo.tcpPorts.forEach { exposedPort, forwardedPort -> + containerInfo.tcpPorts + .findAll { ep, fp -> !settings.tcpPortsToIgnoreWhenWaiting.any { it == ep } } + .forEach { exposedPort, forwardedPort -> logger.lifecycle("Probing TCP socket on ${containerInfo.host}:${forwardedPort} of service '${instanceName}'") while (true) { try {