Add option to customize cache volume names when building an image
This commit adds configuration to the Maven and Gradle plugins to allow specifying the names of build and launch cache volumes provided to the CNB builder. See gh-28292
This commit is contained in:
committed by
Scott Frederick
parent
9d6a0cfd24
commit
dc36346285
@@ -187,6 +187,10 @@ The value supplied will be passed unvalidated to Docker when creating the builde
|
||||
| One or more additional tags to apply to the generated image.
|
||||
|
|
||||
|
||||
| `cacheVolumeNames`
|
||||
| Cache volume names that should be used by the builder instead of generating random names.
|
||||
|
|
||||
|
||||
|===
|
||||
|
||||
NOTE: The plugin detects the target Java compatibility of the project using the compiler's plugin configuration or the `maven.compiler.target` property.
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Scott Frederick
|
||||
* @author Jeroen Meijer
|
||||
* @author Rafael Ceccone
|
||||
* @author Julian Liebig
|
||||
* @since 2.3.0
|
||||
*/
|
||||
public class Image {
|
||||
@@ -69,6 +70,8 @@ public class Image {
|
||||
|
||||
List<String> tags;
|
||||
|
||||
Map<String, String> cacheVolumeNames;
|
||||
|
||||
/**
|
||||
* The name of the created image.
|
||||
* @return the image name
|
||||
@@ -212,6 +215,9 @@ public class Image {
|
||||
if (!CollectionUtils.isEmpty(this.tags)) {
|
||||
request = request.withTags(this.tags.stream().map(ImageReference::of).collect(Collectors.toList()));
|
||||
}
|
||||
if (this.cacheVolumeNames != null && !this.cacheVolumeNames.isEmpty()) {
|
||||
request = request.withCacheVolumeNames(this.cacheVolumeNames);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user