ci: forward SKIP_CAPACITY into docker builds invoking Skip toolchain#1247
Merged
Conversation
Following #1246, SKIP_CAPACITY is set on the CircleCI primary container but does not propagate into nested `docker build` steps, which run on a separate (remote-docker) host. Skip toolchain invocations inside those builds reverted to the runtime's 16 GB default mmap and OOM'd on gen2 hosts that enforce virtual memory limits. Observed in pipeline 4507 / job 16690 (skipruntime): the docker build of skiplabs/skiplang-bin-builder failed at skiplang/Dockerfile:41 with "ERROR (MAP FAILED): Cannot allocate memory" during `make STAGE=0`. Fix in two parts: 1. Declare `ARG SKIP_CAPACITY=` + `ENV SKIP_CAPACITY=$SKIP_CAPACITY` in each Dockerfile whose build invokes the Skip toolchain (Dockerfile, skiplang/Dockerfile, skipruntime-ts/Dockerfile). Default empty so local dev builds keep the runtime's 16 GB default; palloc.c treats empty SKIP_CAPACITY as unset. 2. docker_build.sh forwards $SKIP_CAPACITY (if set) as a build arg to all bake targets that invoke the toolchain, mirroring the existing STAGE forwarding pattern. In CI this picks up the value already set on the job, so no additional config is needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The native addon test scripts run a fresh test container (CMD: node test.js), which loads the Skip runtime via the @skipruntime/native addon. That mmap also defaults to 16 GB and was failing on the gen2 remote-docker host even after the build-time fix. Forward the host's SKIP_CAPACITY env var into the container with `docker run -e SKIP_CAPACITY` (passes through whatever is set, or remains unset to use the runtime's 16 GB default for local dev). Observed in pipeline 4511 / job 16700: docker build succeeded but `docker run` of the test image hit `ERROR (MAP FAILED): Cannot allocate memory` immediately (exit 139). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1246. The previous PR set
SKIP_CAPACITYon the CircleCI primary container, but the value doesn't propagate into nesteddocker buildsteps that run on the remote-docker host. Skip toolchain invocations inside those builds reverted to the runtime's 16 GB defaultmmapand OOM'd on gen2 hosts.Observed in pipeline 4507 / job 16690 (skipruntime job, "Run native addon unreleased test" step): the docker build of
skiplabs/skiplang-bin-builderfailed at skiplang/Dockerfile:41 withERROR (MAP FAILED): Cannot allocate memoryduringmake STAGE=0.Fix
Two parts:
Declare
ARG SKIP_CAPACITY=+ENV SKIP_CAPACITY=$SKIP_CAPACITYin each Dockerfile that invokes the Skip toolchain at build time:bootstrapstage inherits ENV viaskiplang-base)skiplangstage inherits viabase)ARG defaults to empty so local dev builds preserve the runtime's 16 GB default —
palloc.c:449-451treats an emptySKIP_CAPACITYas unset.bin/docker_build.sh forwards
$SKIP_CAPACITY(when set) as a build arg to all bake targets that invoke the toolchain (skiplang,skip,skiplang-bin-builder,skipruntime). Mirrors the existingSTAGEforwarding pattern. In CI this picks up the value already set on the job by ci: set SKIP_CAPACITY on gen2 jobs to fit class RAM #1246, so no additional.circleci/base.ymlchange is needed.Test plan
skipruntime— the "Run native addon unreleased test" step's docker build should no longer fail withMAP FAILED.bin/docker_build.sh skipruntime(withoutSKIP_CAPACITYenv var) still uses the runtime's 16 GB default and builds fine on a developer machine.STAGE=1 bin/docker_build.sh skiplangstill works — the new SKIP_CAPACITY block sits next to STAGE and shouldn't interfere.🤖 Generated with Claude Code