Skip to content

fix(azure): skip the redundant apt round trip when the image already has zram - #712

Merged
defangdevs merged 2 commits into
masterfrom
fix/697-skip-apt-when-image-provided
Sep 16, 2026
Merged

defangdevs merged 2 commits into
masterfrom
fix/697-skip-apt-when-image-provided

Conversation

@defangdevs

@defangdevs defangdevs commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Issue Bake the runtime closure into an Azure image: bootstrap 3m47s, of which 797 MiB is one download #697's "bake it into the image" work already bakes the runtime nix
    closure AND linux-modules-extra (the zram kernel module) into the Azure
    Compute Gallery image (deploy/azure/bake-image.sh), and the bootstrap
    already skips its own nix installer when a box boots from that image
    (deploy/azure/agent-box.bicep, "nix already present (image-provided)").
  • The apt half of that same logic was missing: every boot, image-provided or
    not, still ran apt-get update + apt-get install linux-modules-extra-...
    unconditionally, paying a network round trip and a redundant install to
    reconfirm a package the image already carries.
  • This guards it the same way, on the same signal class the image actually
    provides: modinfo zram (does the kernel module exist on disk) rather than
    a dpkg database check, so it is true for an image-baked box and false for a
    stock-marketplace boot regardless of what else changed.

Context

Prompted by the comment on #697 asking to bake the remaining runtime
closure / apt work into the image. That issue's larger asks (a Community
Gallery, replication regions, rebuild cadence, storage cost) are explicitly
listed there as decisions for a human, not this bot, and none of them are
touched here. This is the one piece of "apt work" in that ask that was a
plain bug with a known fix and no decision attached: the image already does
the work, the bootstrap just wasn't told to trust it.

Test plan

  • az bicep build --file deploy/azure/agent-box.bicep and committed the
    regenerated agent-box.json.
  • python3 scripts/check_azure_template.py (with PyYAML on PYTHONPATH)
    — all 14 checks OK, including the JSON-drift check against a fresh
    build.
  • Live verification against the existing gallery image (as perf(azure): use the allocated IP without settling #709 did for
    the static-IP change) is out of scope for this session — the change is
    a pure skip-guard with no new az calls, verifiable from the script
    logic and the existing bake-image.sh contents alone.

🤖 Generated with Claude Code

…has zram

An agent-box image built by azure-image.yml already installs
linux-modules-extra for the kernel it ships (bake-image.sh), so every boot
from that image was still paying for an apt update + install that could only
ever confirm what was already true. Guard it the same way the nix install
just below already skips its own installer: check what the box actually has
(modinfo zram) rather than re-running apt to find out again (issue #697).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZfTzdVHrqQuChdMKBcj8V
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 18e19248-00e7-44e2-97e5-0cdacc8a1c95

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/697-skip-apt-when-image-provided

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.

@defangdevs
defangdevs merged commit 295ca74 into master Sep 16, 2026
2 checks passed
@defangdevs
defangdevs deleted the fix/697-skip-apt-when-image-provided branch September 16, 2026 03:52
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Agent-Box Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant