Hey ya. In one of my current projects someone decided to use terraform and docker-compose via Gradle. I am currently struggling with a dependency. I have a task defined like that:
Copy code
tasks {
val waitServer by creating {
group = "Docker"
description = "Spin-up fresh builds via Docker"
dependsOn (":reconciliation:dockerBuildImage")
dependsOn(composeUp)
}
}
So I would expect that
./gradlew waitServer
would call
dockerBuildImage
on the
reconciliation
module first and then run
composeUp
. But it goes straight into
composeUp
which fails because the docker image from the
reconciliation
module isn’t built yet. Any ideas?
a
araqnid
04/08/2020, 4:41 PM
I doubt that the order of the dependsOn statements is guaranteed: if composeUp depends on dockerBuildImage, it should explicitly declare that
h
Holger Steinhauer [Mod]
04/08/2020, 4:45 PM
Ah. that might be the reason. Interestingly enough, I adopted this from another repository from the same project and I can’t seem to find the reason why it is working on there without any other configuration. But will try to have the dependency explicitly set
Holger Steinhauer [Mod]
04/08/2020, 5:30 PM
Yeaj, having the dependency set on
composeUp
did the trick. I will check with the colleagues why it works on the other repo anyways. But it really helped me out. Thanks again @araqnid!
a
araqnid
04/08/2020, 5:39 PM
It may simply be that the dependencies are put into a HashSet and it happens to work there by chance