← Back to Pull requests

build: support --ulimit, --shm-size and --cgroup-parent #5345

Open
unknown opened this pull request with 189 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 11, 2026 22:47 UTC
Author

First half of #5344: adds --ulimit, --shm-size and --cgroup-parent to nerdctl build and passes them to BuildKit as frontend attributes. The memory/cpu flags need BuildKit v0.31 and capability checks, so I left them for a follow-up.

A few things worth knowing:

  • --ulimit is a StringSlice like nerdctl run --ulimit. Each value is validated with units.ParseUlimit and they're sent as one comma-separated ulimit attr, which is what BuildKit parses.

  • --shm-size takes the usual 64m style and gets converted to bytes, since BuildKit's shm-size attr is a plain integer.

  • --cgroup-parent: with the systemd cgroup manager, build.slice becomes build.slice:buildkit:, the form BuildKit treats as a slice. It uses the same "xxx.slice" check as nerdctl run. A value that's already in BuildKit's form (contains .slice, ends with :) passes through, and with cgroupfs it's passed as is. This goes by nerdctl's --cgroup-manager, since there's no easy way to ask buildkitd which driver it uses. Open to doing that differently.

  • In rootless mode BuildKit drops the cgroup path, so --cgroup-parent has no effect there (moby/buildkit#7287). I documented that rather than warning. Ulimits and /dev/shm still apply in rootless.
  • Tests: unit tests for the arg conversion and the cgroup parent handling, and an integration test that checks ulimit -n and the /dev/shm size from inside RUN. I only ran the unit tests locally, the integration test needs buildkitd so I'm relying on CI for that one.

    Diff: 189 lines (+141 / -48) across 2 files Reviewer: AkihiroSuda Review duration: 3318m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 189 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.314
    Real PR Conversation Timeline
    1 comments
    "Review active on #5345"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.9% (MEDIUM) · Higher = larger blast radius
    35.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.1% · Safe to merge
    19.1%