avast / gradle-docker-compose-plugin

Simplifies usage of Docker Compose for integration testing in Gradle environment.
MIT License
413 stars 96 forks source link

Allow exposeAsEnvironment and exposeAsProperties to be independent of ComposeUp #427

Open cwensel opened 1 year ago

cwensel commented 1 year ago

I sometimes run ComposeUp/ComposeDownForce from an init script.

for example, running spring boot bootRun, I want to embed the port/host information in the config files.

from and Ide, i already parse the serviceInfos json. having gradle parse and make them available would be useful.

augi commented 10 months ago

Could you please elaborate more on this feature request?

cwensel commented 10 months ago

From what I can tell, the ServiceInfo map is populated when ComposeUp runs (and metadata is written to the build dir), but if it's run from an init script, and then the normal gradle build is run (over and over), the metadata in the serviceinfos files is not read and parsed.

The result is neither exposeAsEnvironment nor exposeAsProperties create env or property values, as they weren't faulted from disk into the cache.

fwiw, my unit tests look for these files so service/host and port mapping can be done, but having the expose* capabilities working in the build file would be great.