Skip to content

ci: forward SKIP_CAPACITY into docker builds invoking Skip toolchain#1247

Merged
mbouaziz merged 2 commits into
mainfrom
ci-skip-capacity-docker-build
May 27, 2026
Merged

ci: forward SKIP_CAPACITY into docker builds invoking Skip toolchain#1247
mbouaziz merged 2 commits into
mainfrom
ci-skip-capacity-docker-build

Conversation

@mbouaziz
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1246. The previous PR set SKIP_CAPACITY on the CircleCI primary container, but the value doesn't propagate into nested docker build steps that run on the remote-docker host. Skip toolchain invocations inside those builds reverted to the runtime's 16 GB default mmap and 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-builder failed at skiplang/Dockerfile:41 with ERROR (MAP FAILED): Cannot allocate memory during make STAGE=0.

Fix

Two parts:

  1. Declare ARG SKIP_CAPACITY= + ENV SKIP_CAPACITY=$SKIP_CAPACITY in each Dockerfile that invokes the Skip toolchain at build time:

    ARG defaults to empty so local dev builds preserve the runtime's 16 GB default — palloc.c:449-451 treats an empty SKIP_CAPACITY as unset.

  2. 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 existing STAGE forwarding 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.yml change is needed.

Test plan

  • After merge, watch the next PR that triggers skipruntime — the "Run native addon unreleased test" step's docker build should no longer fail with MAP FAILED.
  • Confirm local bin/docker_build.sh skipruntime (without SKIP_CAPACITY env var) still uses the runtime's 16 GB default and builds fine on a developer machine.
  • Confirm STAGE=1 bin/docker_build.sh skiplang still works — the new SKIP_CAPACITY block sits next to STAGE and shouldn't interfere.

🤖 Generated with Claude Code

mbouaziz and others added 2 commits May 27, 2026 14:41
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>
@mbouaziz mbouaziz merged commit 1af53fd into main May 27, 2026
4 checks passed
@mbouaziz mbouaziz deleted the ci-skip-capacity-docker-build branch May 27, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant