Skip to content

Commit 5638521

Browse files
committed
Chef - Add --dry_run option for --build_all
1 parent 5b93d57 commit 5638521

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/chef/chef.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ def main(argv: Sequence[str]) -> None:
321321
dest="use_zzz", action="store_true")
322322
parser.add_option("", "--build_all", help="For use in CD only. Builds and bundles all chef examples for the specified platform. Uses --use_zzz. Chef exits after completion.",
323323
dest="build_all", action="store_true")
324+
parser.add_option("", "--dry_run", help="Display list of target builds of the --build_all command without building them.",
325+
dest="dry_run", action="store_true")
324326
parser.add_option("-k", "--keep_going", help="For use in CD only. Continues building all sample apps in the event of an error.",
325327
dest="keep_going", action="store_true")
326328
parser.add_option(
@@ -383,11 +385,14 @@ def main(argv: Sequence[str]) -> None:
383385
flush_print("Building all chef examples")
384386
archive_prefix = "/workspace/artifacts/"
385387
archive_suffix = ".tar.gz"
386-
os.makedirs(archive_prefix, exist_ok=True)
387388
failed_builds = []
388389
for device_name in _DEVICE_LIST:
389390
for platform, label_args in cicd_config["cd_platforms"].items():
390391
for label, args in label_args.items():
392+
archive_name = f"{label}-{device_name}"
393+
if options.dry_run:
394+
flush_print(archive_name)
395+
continue
391396
command = f"./chef.py -cbr --use_zzz -d {device_name} -t {platform} "
392397
command += " ".join(args)
393398
flush_print(f"Building {command}", with_border=True)
@@ -409,7 +414,7 @@ def main(argv: Sequence[str]) -> None:
409414
if not options.keep_going:
410415
exit(1)
411416
continue
412-
archive_name = f"{label}-{device_name}"
417+
os.makedirs(archive_prefix, exist_ok=True)
413418
archive_full_name = archive_prefix + archive_name + archive_suffix
414419
flush_print(f"Adding build output to archive {archive_full_name}")
415420
if os.path.exists(archive_full_name):

0 commit comments

Comments
 (0)