Add pullPolicy option for image building
This commit adds a pullPolicy option to the configuration of the Maven plugin spring-boot:build-image goal and the Gradle plugin bootBuildImage task. The new option gives users control over pulling the builder image and run image from a remote image registry to the local Docker daemon. See gh-22736
This commit is contained in:
committed by
Scott Frederick
parent
b35cfb7fb7
commit
c7449b57ce
@@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.build.BuildRequest;
|
||||
import org.springframework.boot.buildpack.platform.build.PullPolicy;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -194,4 +195,15 @@ class BootBuildImageTests {
|
||||
assertThat(this.buildImage.createRequest().getRunImage().getName()).isEqualTo("test/run");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenUsingDefaultConfigurationThenRequestHasNoPullDisabled() {
|
||||
assertThat(this.buildImage.createRequest().getPullPolicy()).isEqualTo(PullPolicy.ALWAYS);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenNoPullIsEnabledThenRequestHasNoPullEnabled() {
|
||||
this.buildImage.setPullPolicy(PullPolicy.NEVER);
|
||||
assertThat(this.buildImage.createRequest().getPullPolicy()).isEqualTo(PullPolicy.NEVER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user