Skip to content

Commit

Permalink
doc for exposing service info for nested configuration improved
Browse files Browse the repository at this point in the history
  • Loading branch information
jansyk13 authored and augi committed Jul 19, 2018
1 parent 39c6f53 commit a9191c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ dockerCompose {
* It's possible to use all the settings as in the main `dockerCompose` block.
* Configuration of the nested settings defaults to the main `dockerCompose` settings.

When exposing service info from `myNestedComposeUp` task into your task you should use following syntax:
```
test.doFirst {
dockerCompose.myNested.exposeAsEnvironment(test)
}
```

It's also possible to use this simplified syntax:
```gradle
dockerCompose {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.avast.gradle.dockercompose

import spock.lang.Ignore
import spock.lang.Specification

class DockerExecutorTest extends Specification {
Expand Down Expand Up @@ -41,4 +40,21 @@ class DockerExecutorTest extends Specification {
f.project.tasks.composeDown.down()
f.close()
}

def "expose service info from nested task"() {
def f = Fixture.withNginx()
f.project.plugins.apply 'java'
f.project.dockerCompose {
nested { }
}
when:
f.project.tasks.nestedComposeUp.up()
f.extension.nested.exposeAsSystemProperties(f.project.tasks.test)
then:
f.project.tasks.test.properties.systemProperties.containsKey('web.host')
f.project.tasks.test.properties.systemProperties.containsKey('web.tcp.80')
cleanup:
f.project.tasks.nestedComposeDown.down()
f.close()
}
}

0 comments on commit a9191c0

Please sign in to comment.