From bb1d420865f475d82d75f6360409bac18e27bd5c Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Thu, 8 Aug 2019 15:40:09 -0500 Subject: [PATCH] Add cache-from support --- .../plugins/buildkite/BuildkitePipeline.groovy | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePipeline.groovy b/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePipeline.groovy index c707858..dd8e8c5 100644 --- a/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePipeline.groovy +++ b/buildSrc/src/main/groovy/com/widen/plugins/buildkite/BuildkitePipeline.groovy @@ -374,6 +374,20 @@ class BuildkitePipeline implements ConfigurableEnvironment { model.get('env', []) << "$name=$value" } + /** + * Specify a Docker image to pull down to use as a layer cache for building the given service. + */ + void cacheFrom(String service, String image) { + model.get('cache-from', []) << "$service:$image" + } + + /** + * Specify a Docker image to pull down to use as a layer cache for building the given service. + */ + void cacheFrom(String service, String image, String tag) { + cacheFrom(service, "$image:$tag") + } + /** * Add a Docker Compose configuration file to use. */