@@ -77,6 +77,8 @@ public class BuildRequest {
77
77
78
78
private final List <ImageReference > tags ;
79
79
80
+ private final Cache buildWorkspace ;
81
+
80
82
private final Cache buildCache ;
81
83
82
84
private final Cache launchCache ;
@@ -102,6 +104,7 @@ public class BuildRequest {
102
104
this .bindings = Collections .emptyList ();
103
105
this .network = null ;
104
106
this .tags = Collections .emptyList ();
107
+ this .buildWorkspace = null ;
105
108
this .buildCache = null ;
106
109
this .launchCache = null ;
107
110
this .createdDate = null ;
@@ -111,8 +114,8 @@ public class BuildRequest {
111
114
BuildRequest (ImageReference name , Function <Owner , TarArchive > applicationContent , ImageReference builder ,
112
115
ImageReference runImage , Creator creator , Map <String , String > env , boolean cleanCache ,
113
116
boolean verboseLogging , PullPolicy pullPolicy , boolean publish , List <BuildpackReference > buildpacks ,
114
- List <Binding > bindings , String network , List <ImageReference > tags , Cache buildCache , Cache launchCache ,
115
- Instant createdDate , String applicationDirectory ) {
117
+ List <Binding > bindings , String network , List <ImageReference > tags , Cache buildWorkspace , Cache buildCache ,
118
+ Cache launchCache , Instant createdDate , String applicationDirectory ) {
116
119
this .name = name ;
117
120
this .applicationContent = applicationContent ;
118
121
this .builder = builder ;
@@ -127,6 +130,7 @@ public class BuildRequest {
127
130
this .bindings = bindings ;
128
131
this .network = network ;
129
132
this .tags = tags ;
133
+ this .buildWorkspace = buildWorkspace ;
130
134
this .buildCache = buildCache ;
131
135
this .launchCache = launchCache ;
132
136
this .createdDate = createdDate ;
@@ -142,8 +146,8 @@ public BuildRequest withBuilder(ImageReference builder) {
142
146
Assert .notNull (builder , "Builder must not be null" );
143
147
return new BuildRequest (this .name , this .applicationContent , builder .inTaggedOrDigestForm (), this .runImage ,
144
148
this .creator , this .env , this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
145
- this .buildpacks , this .bindings , this .network , this .tags , this .buildCache , this .launchCache ,
146
- this .createdDate , this .applicationDirectory );
149
+ this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace , this .buildCache ,
150
+ this .launchCache , this . createdDate , this .applicationDirectory );
147
151
}
148
152
149
153
/**
@@ -154,8 +158,8 @@ public BuildRequest withBuilder(ImageReference builder) {
154
158
public BuildRequest withRunImage (ImageReference runImageName ) {
155
159
return new BuildRequest (this .name , this .applicationContent , this .builder , runImageName .inTaggedOrDigestForm (),
156
160
this .creator , this .env , this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
157
- this .buildpacks , this .bindings , this .network , this .tags , this .buildCache , this .launchCache ,
158
- this .createdDate , this .applicationDirectory );
161
+ this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace , this .buildCache ,
162
+ this .launchCache , this . createdDate , this .applicationDirectory );
159
163
}
160
164
161
165
/**
@@ -167,7 +171,7 @@ public BuildRequest withCreator(Creator creator) {
167
171
Assert .notNull (creator , "Creator must not be null" );
168
172
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , creator , this .env ,
169
173
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
170
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
174
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
171
175
this .applicationDirectory );
172
176
}
173
177
@@ -184,8 +188,8 @@ public BuildRequest withEnv(String name, String value) {
184
188
env .put (name , value );
185
189
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator ,
186
190
Collections .unmodifiableMap (env ), this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
187
- this .buildpacks , this .bindings , this .network , this .tags , this .buildCache , this .launchCache ,
188
- this .createdDate , this .applicationDirectory );
191
+ this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace , this .buildCache ,
192
+ this .launchCache , this . createdDate , this .applicationDirectory );
189
193
}
190
194
191
195
/**
@@ -199,8 +203,8 @@ public BuildRequest withEnv(Map<String, String> env) {
199
203
updatedEnv .putAll (env );
200
204
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator ,
201
205
Collections .unmodifiableMap (updatedEnv ), this .cleanCache , this .verboseLogging , this .pullPolicy ,
202
- this .publish , this .buildpacks , this .bindings , this .network , this .tags , this .buildCache ,
203
- this .launchCache , this .createdDate , this .applicationDirectory );
206
+ this .publish , this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace ,
207
+ this .buildCache , this . launchCache , this .createdDate , this .applicationDirectory );
204
208
}
205
209
206
210
/**
@@ -211,7 +215,7 @@ public BuildRequest withEnv(Map<String, String> env) {
211
215
public BuildRequest withCleanCache (boolean cleanCache ) {
212
216
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
213
217
cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
214
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
218
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
215
219
this .applicationDirectory );
216
220
}
217
221
@@ -223,7 +227,7 @@ public BuildRequest withCleanCache(boolean cleanCache) {
223
227
public BuildRequest withVerboseLogging (boolean verboseLogging ) {
224
228
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
225
229
this .cleanCache , verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
226
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
230
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
227
231
this .applicationDirectory );
228
232
}
229
233
@@ -235,7 +239,7 @@ public BuildRequest withVerboseLogging(boolean verboseLogging) {
235
239
public BuildRequest withPullPolicy (PullPolicy pullPolicy ) {
236
240
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
237
241
this .cleanCache , this .verboseLogging , pullPolicy , this .publish , this .buildpacks , this .bindings ,
238
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
242
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
239
243
this .applicationDirectory );
240
244
}
241
245
@@ -247,7 +251,7 @@ public BuildRequest withPullPolicy(PullPolicy pullPolicy) {
247
251
public BuildRequest withPublish (boolean publish ) {
248
252
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
249
253
this .cleanCache , this .verboseLogging , this .pullPolicy , publish , this .buildpacks , this .bindings ,
250
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
254
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
251
255
this .applicationDirectory );
252
256
}
253
257
@@ -272,7 +276,7 @@ public BuildRequest withBuildpacks(List<BuildpackReference> buildpacks) {
272
276
Assert .notNull (buildpacks , "Buildpacks must not be null" );
273
277
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
274
278
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , buildpacks , this .bindings ,
275
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
279
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
276
280
this .applicationDirectory );
277
281
}
278
282
@@ -297,7 +301,7 @@ public BuildRequest withBindings(List<Binding> bindings) {
297
301
Assert .notNull (bindings , "Bindings must not be null" );
298
302
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
299
303
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , bindings ,
300
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
304
+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
301
305
this .applicationDirectory );
302
306
}
303
307
@@ -310,7 +314,8 @@ public BuildRequest withBindings(List<Binding> bindings) {
310
314
public BuildRequest withNetwork (String network ) {
311
315
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
312
316
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
313
- network , this .tags , this .buildCache , this .launchCache , this .createdDate , this .applicationDirectory );
317
+ network , this .tags , this .buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
318
+ this .applicationDirectory );
314
319
}
315
320
316
321
/**
@@ -332,7 +337,21 @@ public BuildRequest withTags(List<ImageReference> tags) {
332
337
Assert .notNull (tags , "Tags must not be null" );
333
338
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
334
339
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
335
- this .network , tags , this .buildCache , this .launchCache , this .createdDate , this .applicationDirectory );
340
+ this .network , tags , this .buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
341
+ this .applicationDirectory );
342
+ }
343
+
344
+ /**
345
+ * Return a new {@link BuildRequest} with an updated build workspace.
346
+ * @param buildWorkspace the build workspace
347
+ * @return an updated build request
348
+ */
349
+ public BuildRequest withBuildWorkspace (Cache buildWorkspace ) {
350
+ Assert .notNull (buildWorkspace , "BuildWorkspace must not be null" );
351
+ return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
352
+ this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
353
+ this .network , this .tags , buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
354
+ this .applicationDirectory );
336
355
}
337
356
338
357
/**
@@ -344,7 +363,8 @@ public BuildRequest withBuildCache(Cache buildCache) {
344
363
Assert .notNull (buildCache , "BuildCache must not be null" );
345
364
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
346
365
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
347
- this .network , this .tags , buildCache , this .launchCache , this .createdDate , this .applicationDirectory );
366
+ this .network , this .tags , this .buildWorkspace , buildCache , this .launchCache , this .createdDate ,
367
+ this .applicationDirectory );
348
368
}
349
369
350
370
/**
@@ -356,7 +376,8 @@ public BuildRequest withLaunchCache(Cache launchCache) {
356
376
Assert .notNull (launchCache , "LaunchCache must not be null" );
357
377
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
358
378
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
359
- this .network , this .tags , this .buildCache , launchCache , this .createdDate , this .applicationDirectory );
379
+ this .network , this .tags , this .buildWorkspace , this .buildCache , launchCache , this .createdDate ,
380
+ this .applicationDirectory );
360
381
}
361
382
362
383
/**
@@ -368,8 +389,8 @@ public BuildRequest withCreatedDate(String createdDate) {
368
389
Assert .notNull (createdDate , "CreatedDate must not be null" );
369
390
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
370
391
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
371
- this .network , this .tags , this .buildCache , this .launchCache , parseCreatedDate ( createdDate ) ,
372
- this .applicationDirectory );
392
+ this .network , this .tags , this .buildWorkspace , this .buildCache , this . launchCache ,
393
+ parseCreatedDate ( createdDate ), this .applicationDirectory );
373
394
}
374
395
375
396
private Instant parseCreatedDate (String createdDate ) {
@@ -393,7 +414,8 @@ public BuildRequest withApplicationDirectory(String applicationDirectory) {
393
414
Assert .notNull (applicationDirectory , "ApplicationDirectory must not be null" );
394
415
return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
395
416
this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
396
- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate , applicationDirectory );
417
+ this .network , this .tags , this .buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
418
+ applicationDirectory );
397
419
}
398
420
399
421
/**
@@ -513,6 +535,10 @@ public List<ImageReference> getTags() {
513
535
return this .tags ;
514
536
}
515
537
538
+ public Cache getBuildWorkspace () {
539
+ return this .buildWorkspace ;
540
+ }
541
+
516
542
/**
517
543
* Return the custom build cache that should be used by the lifecycle.
518
544
* @return the build cache
0 commit comments