Add network option for image building
This commit adds configuration to the Maven and Gradle plugins to allow specifying the network mode to be provided to the image building goal and task. See gh-27486
This commit is contained in:
committed by
Scott Frederick
parent
e737388f5c
commit
8e6d03b221
@@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.entry;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
* @author Jeroen Meijer
|
||||
*/
|
||||
class ImageTests {
|
||||
|
||||
@@ -70,6 +71,7 @@ class ImageTests {
|
||||
assertThat(request.getPullPolicy()).isEqualTo(PullPolicy.ALWAYS);
|
||||
assertThat(request.getBuildpacks()).isEmpty();
|
||||
assertThat(request.getBindings()).isEmpty();
|
||||
assertThat(request.getNetwork()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -146,6 +148,14 @@ class ImageTests {
|
||||
Binding.of("volume-name:container-dest:rw"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBuildRequestWhenNetworkUsesNetwork() {
|
||||
Image image = new Image();
|
||||
image.network = "test";
|
||||
BuildRequest request = image.getBuildRequest(createArtifact(), mockApplicationContent());
|
||||
assertThat(request.getNetwork()).isEqualTo("test");
|
||||
}
|
||||
|
||||
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