Allow image Created date to be configurable
A `createdDate` option on the Maven `spring-boot:build-image` goal and the Gradle `bootBuildImage` task can be used to set the `Created` metadata field on a generated OCI image to a specified date or to the current date. Closes gh-28798
This commit is contained in:
@@ -185,6 +185,14 @@ class ImageTests {
|
||||
assertThat(request.getLaunchCache()).isEqualTo(Cache.volume("launch-cache-vol"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBuildRequestWhenHasCreatedDateUsesCreatedDate() {
|
||||
Image image = new Image();
|
||||
image.createdDate = "2020-07-01T12:34:56Z";
|
||||
BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
|
||||
assertThat(request.getCreatedDate()).isEqualTo("2020-07-01T12:34:56Z");
|
||||
}
|
||||
|
||||
private Artifact createArtifact() {
|
||||
return new DefaultArtifact("com.example", "my-app", VersionRange.createFromVersion("0.0.1-SNAPSHOT"), "compile",
|
||||
"jar", null, new DefaultArtifactHandler());
|
||||
|
||||
Reference in New Issue
Block a user