Enable stemcell builds on apple silicon (jammy)#496
Enable stemcell builds on apple silicon (jammy)#496julian-hj wants to merge 2 commits intoubuntu-jammyfrom
Conversation
Use sfdisk instead of parted for disk partitioning. sfdisk causes fewer issues with virutalization, and appears to work reliably with docker desktop running on an m-series mac.
instead of during stemcell building. Also clean up README instructions for docker image building so that they work for M series Mac users.
📝 WalkthroughWalkthroughThe changes update the stemcell builder tooling by switching from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 218-220: The fenced code block showing the Docker/terminal error
message ("ADD failed: failed to compute cache key:
\"/VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle\": not found") in README.md
should include a language specifier; update the triple-backtick fence that
surrounds that error to use a language like `text` or `console` (e.g., ```text)
so the static analysis tool recognizes the block as plain output.
In `@stemcell_builder/stages/image_create_efi/apply.sh`:
- Around line 12-26: Quote the disk image variable in the sfdisk invocation and
correct the size comment: change sfdisk ${disk_image} to use "${disk_image}" to
prevent word-splitting, and update the partition comment in the header (and the
inline comment on the first partition) to say 48MiB (98304 sectors × 512 bytes =
48 MiB) instead of "~49MiB" so comments match the actual size used by the
start/size values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 63579864-89e8-477f-9290-9f08509238a9
📒 Files selected for processing (4)
README.mdci/docker/os-image-stemcell-builder/Dockerfilestemcell_builder/stages/image_create_efi/apply.shstemcell_builder/stages/image_create_efi/config.sh
| ``` | ||
| ADD failed: failed to compute cache key: "/VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle": not found | ||
| ``` |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Add language specifier to the fenced code block.
The static analysis tool flags this code block as missing a language specifier. Since this shows a shell/terminal error message, use text or console.
Proposed fix
-```
+```text
ADD failed: failed to compute cache key: "/VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle": not found</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
```suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)
[warning] 218-218: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` around lines 218 - 220, The fenced code block showing the
Docker/terminal error message ("ADD failed: failed to compute cache key:
\"/VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle\": not found") in README.md
should include a language specifier; update the triple-backtick fence that
surrounds that error to use a language like `text` or `console` (e.g., ```text)
so the static analysis tool recognizes the block as plain output.
|
|
||
| # Partition the disk image using sfdisk | ||
| # sfdisk works better than parted in virtualized environments (Docker Desktop on Apple Silicon) | ||
| # Partition layout: | ||
| # - Partition 1: EFI System Partition (ESP), ~49MiB, type EF (EFI) | ||
| # - Partition 2: Linux root partition, remaining space, type 83 (Linux) | ||
| sfdisk ${disk_image} <<EOF | ||
| label: dos | ||
| unit: sectors | ||
|
|
||
| # First partition: EFI (starts at 2048 sectors = 1MiB, size ~48MiB = 98304 sectors) | ||
| start=2048, size=98304, type=ef, bootable | ||
| # Second partition: Linux root (starts after EFI partition, uses remaining space) | ||
| start=100352, type=83 | ||
| EOF |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Quote the variable to prevent word splitting.
The static analysis tool correctly flags that ${disk_image} should be quoted. While the variable is controlled in this context, quoting prevents issues if paths ever contain spaces.
Also, the comment on line 16 says "~49MiB" but the actual size is 48MiB (98304 sectors × 512 bytes = 48 MiB).
Proposed fix
# Partition the disk image using sfdisk
# sfdisk works better than parted in virtualized environments (Docker Desktop on Apple Silicon)
# Partition layout:
-# - Partition 1: EFI System Partition (ESP), ~49MiB, type EF (EFI)
+# - Partition 1: EFI System Partition (ESP), 48MiB, type EF (EFI)
# - Partition 2: Linux root partition, remaining space, type 83 (Linux)
-sfdisk ${disk_image} <<EOF
+sfdisk "${disk_image}" <<EOF
label: dos
unit: sectors📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Partition the disk image using sfdisk | |
| # sfdisk works better than parted in virtualized environments (Docker Desktop on Apple Silicon) | |
| # Partition layout: | |
| # - Partition 1: EFI System Partition (ESP), ~49MiB, type EF (EFI) | |
| # - Partition 2: Linux root partition, remaining space, type 83 (Linux) | |
| sfdisk ${disk_image} <<EOF | |
| label: dos | |
| unit: sectors | |
| # First partition: EFI (starts at 2048 sectors = 1MiB, size ~48MiB = 98304 sectors) | |
| start=2048, size=98304, type=ef, bootable | |
| # Second partition: Linux root (starts after EFI partition, uses remaining space) | |
| start=100352, type=83 | |
| EOF | |
| # Partition the disk image using sfdisk | |
| # sfdisk works better than parted in virtualized environments (Docker Desktop on Apple Silicon) | |
| # Partition layout: | |
| # - Partition 1: EFI System Partition (ESP), 48MiB, type EF (EFI) | |
| # - Partition 2: Linux root partition, remaining space, type 83 (Linux) | |
| sfdisk "${disk_image}" <<EOF | |
| label: dos | |
| unit: sectors | |
| # First partition: EFI (starts at 2048 sectors = 1MiB, size ~48MiB = 98304 sectors) | |
| start=2048, size=98304, type=ef, bootable | |
| # Second partition: Linux root (starts after EFI partition, uses remaining space) | |
| start=100352, type=83 | |
| EOF |
🧰 Tools
🪛 Shellcheck (0.11.0)
[info] 18-18: Double quote to prevent globbing and word splitting.
(SC2086)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@stemcell_builder/stages/image_create_efi/apply.sh` around lines 12 - 26,
Quote the disk image variable in the sfdisk invocation and correct the size
comment: change sfdisk ${disk_image} to use "${disk_image}" to prevent
word-splitting, and update the partition comment in the header (and the inline
comment on the first partition) to say 48MiB (98304 sectors × 512 bytes = 48
MiB) instead of "~49MiB" so comments match the actual size used by the
start/size values.
Fixed, thanks |
Use sfdisk instead of parted for disk partitioning. sfdisk causes fewer issues with virutalization, and appears to work reliably with docker desktop running on an m-series mac.