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. */