Skip to content

Enable stemcell builds on apple silicon (jammy)#496

Open
julian-hj wants to merge 2 commits intoubuntu-jammyfrom
julian-hj/jammy-build-on-apple-silicon
Open

Enable stemcell builds on apple silicon (jammy)#496
julian-hj wants to merge 2 commits intoubuntu-jammyfrom
julian-hj/jammy-build-on-apple-silicon

Conversation

@julian-hj
Copy link
Copy Markdown
Member

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.

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.
Copy link
Copy Markdown
Contributor

@rkoster rkoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same feedback as in #495 applies here

@github-project-automation github-project-automation bot moved this from Inbox to Waiting for Changes | Open for Contribution in Foundational Infrastructure Working Group Mar 26, 2026
instead of during stemcell building. Also clean up README instructions for docker image building so that they work for M series Mac users.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

📝 Walkthrough

Walkthrough

The changes update the stemcell builder tooling by switching from parted to sfdisk for disk partitioning, add the fdisk package to the Docker image, and correct the README documentation for build workflows, vSphere stemcell instructions, and Docker image rebuilding procedures.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md
Updated local build workflow with explicit --platform linux/amd64, corrected Ruby dependency commands (bundle install), adjusted vSphere stemcell instructions for VMware ovftool placement, updated error message examples, and replaced ./build script guidance with explicit docker build commands.
Docker Tooling
ci/docker/os-image-stemcell-builder/Dockerfile
Added fdisk package installation to the container image via apt-get install.
Disk Partitioning Refactor
stemcell_builder/stages/image_create_efi/apply.sh, stemcell_builder/stages/image_create_efi/config.sh
Replaced parted-based partitioning with sfdisk, switching from percentage-driven boundaries to fixed-sector layout with explicit EFI System Partition (sector-based, type ef) and Linux partition (type 83) definitions. Updated tool availability check from parted to sfdisk.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 The disks are partitioned with sfdisk's keen sight,
Where sectors align and boundaries grow tight,
Fdisk joins the toolkit, the builder stands tall,
With Docker steps clear and documented for all! 🏗️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main objective of enabling stemcell builds on Apple Silicon Macs with the jammy distribution.
Description check ✅ Passed The description explains the core change (replacing parted with sfdisk) and its benefit for Docker Desktop on M-series Macs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch julian-hj/jammy-build-on-apple-silicon

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a38d4ea and fd7e70a.

📒 Files selected for processing (4)
  • README.md
  • ci/docker/os-image-stemcell-builder/Dockerfile
  • stemcell_builder/stages/image_create_efi/apply.sh
  • stemcell_builder/stages/image_create_efi/config.sh

Comment on lines +218 to +220
```
ADD failed: failed to compute cache key: "/VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle": not found
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Comment on lines +12 to +26

# 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.

Suggested change
# 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.

@julian-hj
Copy link
Copy Markdown
Member Author

Same feedback as in #495 applies here

Fixed, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting for Changes | Open for Contribution

Development

Successfully merging this pull request may close these issues.

2 participants