Skip to content

Commit

Permalink
Allow tcp ignore for waiting (#169)
Browse files Browse the repository at this point in the history
option to ignore TCP ports when waiting
  • Loading branch information
augi committed Oct 3, 2018
1 parent e3572d8 commit 35ec229
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ComposeSettings {
boolean buildBeforeUp = true
boolean buildBeforePull = true
boolean waitForTcpPorts = true
List<Integer> tcpPortsToIgnoreWhenWaiting = []
Duration waitAfterTcpProbeFailure = Duration.ofSeconds(1)
Duration waitForTcpPortsTimeout = Duration.ofMinutes(15)
Duration waitForTcpPortsDisconnectionProbeTimeout = Duration.ofMillis(1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 35ec229

Please sign in to comment.