This is an automated email from the ASF dual-hosted git repository. damccorm pushed a commit to branch users/damccorm/dockerPrune in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/users/damccorm/dockerPrune by this push: new 81b793469df Consolidate to loop 81b793469df is described below commit 81b793469df0f57de118ff40f1fafb20dc2fc00c Author: Danny McCormick <dannymccorm...@google.com> AuthorDate: Thu Jun 29 18:49:37 2023 -0400 Consolidate to loop --- sdks/python/container/build.gradle | 76 +++++++++----------------------------- 1 file changed, 17 insertions(+), 59 deletions(-) diff --git a/sdks/python/container/build.gradle b/sdks/python/container/build.gradle index 7b223ce7e56..eeb2220c6d4 100644 --- a/sdks/python/container/build.gradle +++ b/sdks/python/container/build.gradle @@ -42,65 +42,23 @@ tasks.register("buildAll") { dependsOn ':sdks:python:container:py311:docker' } -tasks.register("push38") { - dependsOn ':sdks:python:container:py38:dockerPush' - - doLast { - if (project.hasProperty("prune-images")) { - exec { - executable("docker") - args("system", "prune", "-a", "--force") - } - } - } -} - -tasks.register("push39") { - // Enforce ordering to allow the prune step to happen between runs. - // This will ensure we don't use up too much space (especially in CI environments) - mustRunAfter(":sdks:python:container:push38") - - dependsOn ':sdks:python:container:py39:dockerPush' - - doLast { - if (project.hasProperty("prune-images")) { - exec { - executable("docker") - args("system", "prune", "-a", "--force") - } - } - } -} - -tasks.register("push310") { - // Enforce ordering to allow the prune step to happen between runs. - // This will ensure we don't use up too much space (especially in CI environments) - mustRunAfter(":sdks:python:container:push39") - - dependsOn ':sdks:python:container:py310:dockerPush' - - doLast { - if (project.hasProperty("prune-images")) { - exec { - executable("docker") - args("system", "prune", "-a", "--force") - } - } - } -} - -tasks.register("push311") { - // Enforce ordering to allow the prune step to happen between runs. - // This will ensure we don't use up too much space (especially in CI environments) - mustRunAfter(":sdks:python:container:push310") - - dependsOn ':sdks:python:container:py311:dockerPush' - - doLast { - if (project.hasProperty("prune-images")) { - exec { - executable("docker") - args("system", "prune", "-a", "--force") +for(int i=8; i<=11; ++i) { + String cur = "3" + i + String prev = "3" + (i-1) + tasks.register("push" + cur) { + if (cur != "38") { + // Enforce ordering to allow the prune step to happen between runs. + // This will ensure we don't use up too much space (especially in CI environments) + mustRunAfter(":sdks:python:container:push" + prev) + } + dependsOn ':sdks:python:container:py' + cur + ':dockerPush' + + doLast { + if (project.hasProperty("prune-images")) { + exec { + executable("docker") + args("system", "prune", "-a", "--force") + } } } }