Skip to content

Let installations admit server builds and limit their container time - #459

Merged
tnkuehne merged 1 commit into
server-buildsfrom
server-builds-limits
Nov 28, 2026
Merged

tnkuehne merged 1 commit into
server-buildsfrom
server-builds-limits

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What

Server builds (#455) cost container time. With this change an installation can decide who builds and for how long.

  • Build policy: a runtime extension can provide buildPolicy (runtime-extension.ts).
    • admit runs in the transaction that records a build. It returns the seconds of container time the build may use, or why it cannot start, for example because the organization has no build time.
    • settle runs in the transaction that finishes the build, with the container time the CI reported. It runs only then, so each build settles at most once.
    • A build that ends without that report keeps its whole reservation. This happens when its workflow stopped, the setup failed, or the CI lost the run. Its container may still run until its deadline. The policy can keep the slot and the charge until then.
    • @platform/control-plane/builds exports ciBuildTimeLimit, the most a policy can grant.
  • Time limit: a build's deadline is its admission plus the seconds the policy granted, at most 30 minutes. It counts from the transaction that admits the build, as the policy's reservation does.
    • No run of the build goes past the deadline, so a build that waited past it in the queue runs no container at all.
    • An alarm in the Durable Object stops the container at the deadline, even if the object restarts in between.
    • A run that the object lost counts until it restarted, at most until the deadline.
    • The CI reports the container time it used (seconds).
  • Without a policy: every build may use the CI's longest build time. Self-hosted installations pay for their own Cloudflare account.

Checks

  • pnpm lint, typecheck, format
  • pnpm exec vitest run in the control plane: all tests pass, including new builds.integration.test.ts cases:
    • a build the policy refuses is not recorded and gets no workflow
    • granted time reaches the CI, and the used time is settled once
    • builds that end without the CI's time keep their reservation
    • the CI receives the deadline of the granted time

@tnkuehne
tnkuehne added this pull request to stack #460 November 28, 2026 00:11
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs e95f437 Nov 28 2026, 01:26 PM

@tnkuehne
tnkuehne force-pushed the server-builds-limits branch 3 times, most recently from d643d50 to c48cf07 Compare November 28, 2026 12:53
@tnkuehne
tnkuehne force-pushed the server-builds-limits branch 2 times, most recently from d643d50 to 4a8bf8c Compare November 28, 2026 12:57
A build policy admits each build in the transaction that records it and
grants it container time. The build stops when that time after its
admission is over, however often it runs. The CI counts the time of all
of a build's runs, a lost run at most until the deadline, and the policy
settles it as the build finishes.

The CI's longest build time is exported for policies.
@tnkuehne
tnkuehne force-pushed the server-builds-limits branch from 4a8bf8c to e95f437 Compare November 28, 2026 13:25
@tnkuehne
tnkuehne merged commit 76c4ee7 into main Nov 28, 2026
16 checks passed
@tnkuehne
tnkuehne deleted the server-builds-limits branch November 28, 2026 13:38
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