Conversation
🦋 Changeset detectedLatest commit: fe40abd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Contributor
🐳 Docker Images Published
Usage: FROM cloudflare/sandbox:0.0.0-pr-798-fe40abdcVersion: 📦 Standalone BinaryFor arbitrary Dockerfiles: COPY --from=cloudflare/sandbox:0.0.0-pr-798-fe40abdc /container-server/sandbox /sandbox
ENTRYPOINT ["/sandbox"]Download via GitHub CLI: gh run download 28510547234 -n sandbox-binaryExtract from Docker: docker run --rm cloudflare/sandbox:0.0.0-pr-798-fe40abdc cat /container-server/sandbox > sandbox && chmod +x sandbox |
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.
Fixes #790
Container instances created through the Sandbox SDK could not be tagged with custom metadata. The underlying Cloudflare Containers platform supports key-value labels that flow into the analytics pipeline, where they can be used to filter and group usage metrics by dimensions such as tenant, environment, or workload. The SDK exposed sleep and transport options through
SandboxOptionsbut offered no way to set labels, so callers had no first-class path to attribute container usage back to their own entities. This addresses the request in #790.This change adds a
labelsfield toSandboxOptions, letting callers attach labels at the same call site they already use to configure a sandbox. Labels are stored on the sandbox and applied when the container next starts, which keeps them consistent with how the platform consumes them. Changing labels while a container is already running is allowed, but the new values only take effect on the following start.The platform validates label names when the container starts and rejects anything that is not a non-empty string of letters, digits, and underscores, along with control characters in label values. On its own, that means a typo such as a hyphen in a label name would only fail later, at the first operation that starts the container, far from where the label was supplied. To close that gap, labels are now validated synchronously inside
getSandbox()so a bad label throws immediately at the call site with a clear message.You can verify the behavior locally by calling
getSandbox()with a valid set of labels and confirming the container starts as normal, then repeating the call with a label name that contains a hyphen or other disallowed character and observing that it throws before any container work happens. In local development the applied labels are visible on the underlying container throughdocker inspect.The validation rules are covered by unit tests in the SDK that assert invalid names, empty names, and control characters in values are rejected, and that valid names pass through untouched. The existing label configuration and caching tests continue to pass.
The package README and the
SandboxOptionstype documentation now describe thelabelsoption and its constraints so the naming rules are discoverable without reaching for the platform documentation.