36
36
* @author Phillip Webb
37
37
* @author Scott Frederick
38
38
* @author Andrey Shlykov
39
+ * @author Jeroen Meijer
39
40
* @since 2.3.0
40
41
*/
41
42
public class BuildRequest {
@@ -68,6 +69,8 @@ public class BuildRequest {
68
69
69
70
private final List <Binding > bindings ;
70
71
72
+ private final String network ;
73
+
71
74
BuildRequest (ImageReference name , Function <Owner , TarArchive > applicationContent ) {
72
75
Assert .notNull (name , "Name must not be null" );
73
76
Assert .notNull (applicationContent , "ApplicationContent must not be null" );
@@ -83,12 +86,13 @@ public class BuildRequest {
83
86
this .creator = Creator .withVersion ("" );
84
87
this .buildpacks = Collections .emptyList ();
85
88
this .bindings = Collections .emptyList ();
89
+ this .network = null ;
86
90
}
87
91
88
92
BuildRequest (ImageReference name , Function <Owner , TarArchive > applicationContent , ImageReference builder ,
89
93
ImageReference runImage , Creator creator , Map <String , String > env , boolean cleanCache ,
90
94
boolean verboseLogging , PullPolicy pullPolicy , boolean publish , List <BuildpackReference > buildpacks ,
91
- List <Binding > bindings ) {
95
+ List <Binding > bindings , String network ) {
92
96
this .name = name ;
93
97
this .applicationContent = applicationContent ;
94
98
this .builder = builder ;
@@ -101,6 +105,7 @@ public class BuildRequest {
101
105
this .publish = publish ;
102
106
this .buildpacks = buildpacks ;
103
107
this .bindings = bindings ;
108
+ this .network = network ;
104
109
}
105
110
106
111
/**
@@ -112,7 +117,7 @@ public BuildRequest withBuilder(ImageReference builder) {
112
117
Assert .notNull (builder , "Builder must not be null" );
113
118
return new BuildRequest (this .name , this .applicationContent , builder .inTaggedOrDigestForm (), this .runImage ,
114
119
this .creator , this .env , this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
115
- this .buildpacks , this .bindings );
120
+ this .buildpacks , this .bindings , this . network );
116
121
}
117
122
118
123
/**
@@ -123,7 +128,7 @@ public BuildRequest withBuilder(ImageReference builder) {
123
128
public BuildRequest withRunImage (ImageReference runImageName ) {
124
129
return new BuildRequest (this .name , this .applicationContent , this .builder , runImageName .inTaggedOrDigestForm (),
125
130
this .creator , this .env , this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
126
- this .buildpacks , this .bindings );
131
+ this .buildpacks , this .bindings , this . network );
127
132
}
128
133
129
134
/**
@@ -134,7 +139,8 @@ public BuildRequest withRunImage(ImageReference runImageName) {
134
139
public BuildRequest withCreator (Creator creator ) {
135
140
Assert .notNull (creator , "Creator must not be null" );
136
141
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , creator , this .env ,
137
- this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings );
142
+ this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
143
+ this .network );
138
144
}
139
145
140
146
/**
@@ -150,7 +156,7 @@ public BuildRequest withEnv(String name, String value) {
150
156
env .put (name , value );
151
157
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator ,
152
158
Collections .unmodifiableMap (env ), this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
153
- this .buildpacks , this .bindings );
159
+ this .buildpacks , this .bindings , this . network );
154
160
}
155
161
156
162
/**
@@ -164,7 +170,7 @@ public BuildRequest withEnv(Map<String, String> env) {
164
170
updatedEnv .putAll (env );
165
171
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator ,
166
172
Collections .unmodifiableMap (updatedEnv ), this .cleanCache , this .verboseLogging , this .pullPolicy ,
167
- this .publish , this .buildpacks , this .bindings );
173
+ this .publish , this .buildpacks , this .bindings , this . network );
168
174
}
169
175
170
176
/**
@@ -174,7 +180,8 @@ public BuildRequest withEnv(Map<String, String> env) {
174
180
*/
175
181
public BuildRequest withCleanCache (boolean cleanCache ) {
176
182
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
177
- cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings );
183
+ cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
184
+ this .network );
178
185
}
179
186
180
187
/**
@@ -184,7 +191,8 @@ public BuildRequest withCleanCache(boolean cleanCache) {
184
191
*/
185
192
public BuildRequest withVerboseLogging (boolean verboseLogging ) {
186
193
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
187
- this .cleanCache , verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings );
194
+ this .cleanCache , verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
195
+ this .network );
188
196
}
189
197
190
198
/**
@@ -194,7 +202,8 @@ public BuildRequest withVerboseLogging(boolean verboseLogging) {
194
202
*/
195
203
public BuildRequest withPullPolicy (PullPolicy pullPolicy ) {
196
204
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
197
- this .cleanCache , this .verboseLogging , pullPolicy , this .publish , this .buildpacks , this .bindings );
205
+ this .cleanCache , this .verboseLogging , pullPolicy , this .publish , this .buildpacks , this .bindings ,
206
+ this .network );
198
207
}
199
208
200
209
/**
@@ -204,7 +213,8 @@ public BuildRequest withPullPolicy(PullPolicy pullPolicy) {
204
213
*/
205
214
public BuildRequest withPublish (boolean publish ) {
206
215
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
207
- this .cleanCache , this .verboseLogging , this .pullPolicy , publish , this .buildpacks , this .bindings );
216
+ this .cleanCache , this .verboseLogging , this .pullPolicy , publish , this .buildpacks , this .bindings ,
217
+ this .network );
208
218
}
209
219
210
220
/**
@@ -227,7 +237,8 @@ public BuildRequest withBuildpacks(BuildpackReference... buildpacks) {
227
237
public BuildRequest withBuildpacks (List <BuildpackReference > buildpacks ) {
228
238
Assert .notNull (buildpacks , "Buildpacks must not be null" );
229
239
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
230
- this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , buildpacks , this .bindings );
240
+ this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , buildpacks , this .bindings ,
241
+ this .network );
231
242
}
232
243
233
244
/**
@@ -250,7 +261,14 @@ public BuildRequest withBindings(Binding... bindings) {
250
261
public BuildRequest withBindings (List <Binding > bindings ) {
251
262
Assert .notNull (bindings , "Bindings must not be null" );
252
263
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
253
- this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , bindings );
264
+ this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , bindings ,
265
+ this .network );
266
+ }
267
+
268
+ public BuildRequest withNetwork (String network ) {
269
+ return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
270
+ this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
271
+ network );
254
272
}
255
273
256
274
/**
@@ -353,6 +371,10 @@ public List<Binding> getBindings() {
353
371
return this .bindings ;
354
372
}
355
373
374
+ public String getNetwork () {
375
+ return this .network ;
376
+ }
377
+
356
378
/**
357
379
* Factory method to create a new {@link BuildRequest} from a JAR file.
358
380
* @param jarFile the source jar file
0 commit comments