Make docker build task incremental (#49613)
This commits sets an output marker file for the docker build tasks so that it can be tracked as up to date. It also fixes the docker build context task to omit the build date as in input property which always left the task as out of date. relates #49359
This commit is contained in:
parent
d66795fdf0
commit
9c6a5a09af
|
@ -72,7 +72,7 @@ project.ext {
|
||||||
|
|
||||||
void addCopyDockerContextTask(final boolean oss, final boolean ubi) {
|
void addCopyDockerContextTask(final boolean oss, final boolean ubi) {
|
||||||
task(taskName("copy", oss, ubi, "DockerContext"), type: Sync) {
|
task(taskName("copy", oss, ubi, "DockerContext"), type: Sync) {
|
||||||
expansions(oss, ubi, true).each { k, v ->
|
expansions(oss, ubi, true).findAll { it.key != 'build_date' }.each { k, v ->
|
||||||
inputs.property(k, { v.toString() })
|
inputs.property(k, { v.toString() })
|
||||||
}
|
}
|
||||||
into buildPath(oss, ubi)
|
into buildPath(oss, ubi)
|
||||||
|
@ -173,6 +173,11 @@ void addBuildDockerImage(final boolean oss, final boolean ubi) {
|
||||||
dockerArgs.add(tag)
|
dockerArgs.add(tag)
|
||||||
}
|
}
|
||||||
args dockerArgs.toArray()
|
args dockerArgs.toArray()
|
||||||
|
File markerFile = file("build/markers/${it.name}.marker")
|
||||||
|
outputs.file(markerFile)
|
||||||
|
doLast {
|
||||||
|
markerFile.setText('', 'UTF-8')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assemble.dependsOn(buildDockerImageTask)
|
assemble.dependsOn(buildDockerImageTask)
|
||||||
BuildPlugin.requireDocker(buildDockerImageTask)
|
BuildPlugin.requireDocker(buildDockerImageTask)
|
||||||
|
@ -209,6 +214,7 @@ subprojects { Project subProject ->
|
||||||
|
|
||||||
final Task exportDockerImageTask = task(exportTaskName, type: LoggedExec) {
|
final Task exportDockerImageTask = task(exportTaskName, type: LoggedExec) {
|
||||||
executable 'docker'
|
executable 'docker'
|
||||||
|
outputs.file(tarFile)
|
||||||
args "save",
|
args "save",
|
||||||
"-o",
|
"-o",
|
||||||
tarFile,
|
tarFile,
|
||||||
|
|
Loading…
Reference in New Issue