Commit fa28e69
feat: add --image-mount flag to bake images-to-mount init scripts
Add support for loading images-to-mount YAML files and appending their
shell init snippets to /sandbox/.bashrc and /sandbox/.zshrc inside the
built image.
- src/image_mount.rs (new): parse images-to-mount YAML files (local
path or URL), derive the mount name from the filename stem, and
replace $MOUNT with /sandbox/mnt/<name> in the init value.
- src/containerfile.rs: introduce ContainerfileOptions struct to
replace the positional argument list in generate(); add
image_mount_inits field that emits printf calls appending each
resolved init snippet to .bashrc and .zshrc in the same RUN layer
that creates the profile files; add init_for_printf() helper that
escapes backslashes, newlines, and single quotes for safe use in a
single-quoted shell printf argument; add unit tests covering
ordering, multiple mounts, single-quote escaping, and the
no-mount-no-zshrc invariant.
- src/main.rs: add --image-mount <PATH|URL> CLI flag (clap Append
action, repeatable); thread image_mounts through run(); add unit
tests for single mount, multiple mounts, and invalid path error.
- tests/integration_test.rs: add image_mount module with integration
tests (marked #[ignore] for those requiring podman) covering .bashrc
and .zshrc content, sandbox ownership, and absence of .zshrc when
the flag is not used; add non-ignored binary smoke-test for the
invalid-path error path; register cleanup of the new test image tag.
- README.md: document the new flag — YAML format, $MOUNT substitution
rule, files written, CLI examples, and option table entry.
Co-authored-by: Claude <claude@anthropic.com>
Signed-off-by: Philippe Martin <phmartin@redhat.com>1 parent 8b192b1 commit fa28e69
5 files changed
Lines changed: 731 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
498 | 499 | | |
499 | 500 | | |
500 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
501 | 549 | | |
502 | 550 | | |
503 | 551 | | |
| |||
516 | 564 | | |
517 | 565 | | |
518 | 566 | | |
| 567 | + | |
519 | 568 | | |
520 | 569 | | |
521 | 570 | | |
| |||
0 commit comments