Merge branch '2.3.x'

Closes gh-21895
pull/21912/head
Phillip Webb 5 years ago
commit 3892f4402a

@ -84,8 +84,9 @@ public class BuildRequest {
*/ */
public BuildRequest withBuilder(ImageReference builder) { public BuildRequest withBuilder(ImageReference builder) {
Assert.notNull(builder, "Builder must not be null"); Assert.notNull(builder, "Builder must not be null");
return new BuildRequest(this.name, this.applicationContent, builder.inTaggedForm(), this.creator, this.env, builder = (builder.getDigest() != null) ? builder : builder.inTaggedForm();
this.cleanCache, this.verboseLogging); return new BuildRequest(this.name, this.applicationContent, builder, this.creator, this.env, this.cleanCache,
this.verboseLogging);
} }
/** /**

@ -98,6 +98,14 @@ public class BuildRequestTests {
assertThat(request.getBuilder().toString()).isEqualTo("docker.io/spring/builder:latest"); assertThat(request.getBuilder().toString()).isEqualTo("docker.io/spring/builder:latest");
} }
@Test
void withBuilderWhenHasDigestUpdatesBuilder() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar")).withBuilder(ImageReference
.of("spring/builder:@sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d"));
assertThat(request.getBuilder().toString()).isEqualTo(
"docker.io/spring/builder:@sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d");
}
@Test @Test
void withCreatorUpdatesCreator() throws IOException { void withCreatorUpdatesCreator() throws IOException {
BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar")); BuildRequest request = BuildRequest.forJarFile(writeTestJarFile("my-app-0.0.1.jar"));

Loading…
Cancel
Save