Set Spring Boot version in ephemeral builder

This commit adds a `createdBy` structure to the metadata of the ephemeral
builder container image that identifies Spring Boot as the creator of the
image, along with the Spring Boot version.

See gh-20126
This commit is contained in:
Scott Frederick
2020-02-11 16:26:00 -06:00
parent 97af0b2f3a
commit 191dce3f5e
12 changed files with 297 additions and 57 deletions

View File

@@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* Tests for {@link BootBuildImage}.
*
* @author Andy Wilkinson
* @author Scott Frederick
*/
class BootBuildImageTests {
@@ -81,6 +82,13 @@ class BootBuildImageTests {
assertThat(request.getName().getDigest()).isNull();
}
@Test
void springBootVersionDefaultValueIsUsed() {
BuildRequest request = this.buildImage.createRequest();
assertThat(request.getCreator().getName()).isEqualTo("Spring Boot");
assertThat(request.getCreator().getVersion()).isEqualTo("");
}
@Test
void whenIndividualEntriesAreAddedToTheEnvironmentThenTheyAreIncludedInTheRequest() {
this.buildImage.environment("ALPHA", "a");
@@ -91,7 +99,7 @@ class BootBuildImageTests {
@Test
void whenEntriesAreAddedToTheEnvironmentThenTheyAreIncludedInTheRequest() {
Map<String, String> environment = new HashMap<String, String>();
Map<String, String> environment = new HashMap<>();
environment.put("ALPHA", "a");
environment.put("BRAVO", "b");
this.buildImage.environment(environment);
@@ -101,7 +109,7 @@ class BootBuildImageTests {
@Test
void whenTheEnvironmentIsSetItIsIncludedInTheRequest() {
Map<String, String> environment = new HashMap<String, String>();
Map<String, String> environment = new HashMap<>();
environment.put("ALPHA", "a");
environment.put("BRAVO", "b");
this.buildImage.setEnvironment(environment);
@@ -111,7 +119,7 @@ class BootBuildImageTests {
@Test
void whenTheEnvironmentIsSetItReplacesAnyExistingEntriesAndIsIncludedInTheRequest() {
Map<String, String> environment = new HashMap<String, String>();
Map<String, String> environment = new HashMap<>();
environment.put("ALPHA", "a");
environment.put("BRAVO", "b");
this.buildImage.environment("C", "Charlie");