containers: add custom labels support to container start options#6352
containers: add custom labels support to container start options#6352martinezjandrew merged 14 commits intomainfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds custom label forwarding from the JS container API through to the capnp StartParams and Docker ContainerCreateRequest. The capnp schema change is additive and wire-compatible.
Findings (ranked by severity):
-
[MEDIUM] No input validation on label names or values — The
envdict validates against=and\0characters, butlabelspasses names/values through with no validation at all. Since labels flow to Docker and GraphQL, consider adding basic bounds checks (e.g., label count limit, key/value length limits, reject empty keys). At minimum, empty label names should be rejected. -
[LOW] C++ test duplicates production encoding logic — The label→Docker JSON encoding in both test cases is copy-pasted from
container-client.c++rather than exercised throughcreateContainer(). If the production code is refactored, these tests would pass with stale logic.
This review was generated by an AI assistant and may contain inaccuracies. Please verify any suggestions before applying them.
|
Review posted on PR #6352. Two findings:
The capnp schema change is additive ( |
|
The generated output of |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
Merging this PR will not alter performance
Comparing Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6352 +/- ##
==========================================
- Coverage 70.71% 70.70% -0.02%
==========================================
Files 420 420
Lines 113702 113727 +25
Branches 18731 18740 +9
==========================================
+ Hits 80410 80414 +4
- Misses 22061 22084 +23
+ Partials 11231 11229 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
petebacondarwin
left a comment
There was a problem hiding this comment.
Approved the typings changes on behalf of Wrangler team.
Customers want to attach custom labels to containers so that they can filter based on them in GraphQL.
Originally, labels were supported at the deployments API level but not through the DO binding. The
StartupOptionsstruct accepted alabelsfield from JS, butcontainer.c++:start()never forwarded it to the capnpStartParams. Labels were silently dropped before the runtime/launcher could receive them.This PR aims to resolve this by:
Labelstruct andlabelsfield toStartParamsincontainer.capnpcontainer.capnpdocker inspect