This message was deleted.
# dependency-management
s
This message was deleted.
a
there was a similar discussion about caching+docker+integration tests recently here: https://gradle-community.slack.com/archives/CAHSN3LDN/p1682667792218029
are the Docker images built with a Gradle task? What you could try is to add the Docker image hash as an input to the test task, so Gradle will re-run the task if the image hash changes. Something like
Copy code
tasks.test.configure {
  val imageName = "my-image"
  inputs.property("dockerImageHash",
    providers.exec {
      executable("docker")
      args(parseSpaceSeparatedArgs("inspect --format='{{index .RepoDigests 0}}' $imageName"))
    }.standardOutput.asText)
  }
}
n
There is a new docker image generated on every build though because the docker image has embedded in it the version number which changes on every build.
a
to me that would indicate there’s a change, so it makes sense to re-run the tests :)
unless the version number isn’t used in the code, in which case, it could be removed so that the builds are reproducible?
another option is to create a custom Configuration in your e2e subproject, that’s independent of the standard Java Configurations
Copy code
val intTestUpToDateCheck by configurations.creating {
  isCanBeConsumed = false
  isCanBeResolved = true
}

dependencies {
  intTestUpToDateCheck(project(":my-service"))
}

tasks.test.configure {
  inputs.files(intTestUpToDateCheck)
}
(writing by hand - the syntax might need some work) that way if
my-service
changes then the task will re-run, but because the dependency isn’t used for anything else the files won’t be visible in the source code
n
This could work!
The version is used in various places for logging and metrics etc