@@ -35,6 +35,7 @@ class ImageBuildResult(NamedTuple):
35
35
img_path : str
36
36
img_arch : str
37
37
container_ref : str
38
+ build_container_ref : str
38
39
rootfs : str
39
40
disk_config : str
40
41
username : str
@@ -314,7 +315,7 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload, gpg_
314
315
bib_output = bib_output_path .read_text (encoding = "utf8" )
315
316
results .append (ImageBuildResult (
316
317
image_type , generated_img , tc .target_arch ,
317
- container_ref , tc .rootfs , tc .disk_config ,
318
+ container_ref , tc .build_container_ref , tc . rootfs , tc .disk_config ,
318
319
username , password ,
319
320
ssh_keyfile_private_path , kargs , bib_output , journal_output ))
320
321
@@ -384,6 +385,7 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload, gpg_
384
385
upload_args = []
385
386
creds_args = []
386
387
target_arch_args = []
388
+ build_container_args = []
387
389
if tc .target_arch :
388
390
target_arch_args = ["--target-arch" , tc .target_arch ]
389
391
@@ -433,10 +435,16 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload, gpg_
433
435
# Pull the signed image
434
436
testutil .pull_container (container_ref , tls_verify = False )
435
437
438
+ if tc .build_container_ref :
439
+ build_container_args = [
440
+ "--build-container" , tc .build_container_ref ,
441
+ ]
442
+
436
443
cmd .extend ([
437
444
* creds_args ,
438
445
build_container ,
439
446
container_ref ,
447
+ * build_container_args ,
440
448
* types_arg ,
441
449
* upload_args ,
442
450
* target_arch_args ,
@@ -476,7 +484,7 @@ def del_ami():
476
484
for image_type in image_types :
477
485
results .append (ImageBuildResult (
478
486
image_type , artifact [image_type ], tc .target_arch ,
479
- container_ref , tc .rootfs , tc .disk_config ,
487
+ container_ref , tc .build_container_ref , tc . rootfs , tc .disk_config ,
480
488
username , password ,
481
489
ssh_keyfile_private_path , kargs , bib_output , journal_output , metadata ))
482
490
yield results
@@ -510,6 +518,12 @@ def test_image_is_generated(image_type):
510
518
f"content: { os .listdir (os .fspath (image_type .img_path ))} "
511
519
512
520
521
+ @pytest .mark .parametrize ("image_type" , gen_testcases ("build-container" ), indirect = ["image_type" ])
522
+ def test_build_container_works (image_type ):
523
+ assert image_type .img_path .exists (), "output file missing, dir " \
524
+ f"content: { os .listdir (os .fspath (image_type .img_path ))} "
525
+
526
+
513
527
def assert_kernel_args (test_vm , image_type ):
514
528
exit_status , kcmdline = test_vm .run ("cat /proc/cmdline" , user = image_type .username , password = image_type .password )
515
529
assert exit_status == 0
0 commit comments