You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attach team_id metadata to uploaded storage objects (#2533)
* Attach team / build lineage labels to uploaded storage objects
Adds custom object metadata to GCS/S3 uploads from snapshot/template
builds so artifacts can be filtered after upload. Local filesystem
backend is a no-op.
Per-object labels (every artifact in {buildID}/):
- team_id
- root_build_id
Per-build labels (only on {buildID}/metadata.json):
- build_kind (template_layer | sandbox_pause | sandbox_checkpoint)
- parent_build_id
The Blob.Put / Seekable.StoreFile interfaces gain a variadic
PutOption, with WithMetadata as the first option. Snapshot.Upload
and TemplateBuild take a SnapshotUploadMetadata{Common, MetadataOnly}
to control what goes on every object vs. only on metadata.json.
Option types live in a new storageopts subpackage so generated mocks
can reference them without an import cycle.
* Address review: BaseBuildId for snapshot root, log source-meta error, fix nlreturn
- root_build_id for sandbox pause/checkpoint now uses
snapshot.MemfileDiffHeader.Metadata.BaseBuildId (the diff-chain root /
originating template), preserved across pause -> resume -> pause.
Falls back to the snapshot's own build ID if the header is missing.
Layer builds keep BuildContext.Template.BuildID since it's the
user-requested top-level build (not redundant with the path).
- Log a warning when localTemplate.Metadata() fails in BuildLayer
instead of silently dropping parent_build_id.
- Restore blank lines before returns in template_build.go to satisfy
the nlreturn linter.
* Use BaseBuildId from header for root_build_id everywhere; omit when unknown
root_build_id should be the very first build ID in the lineage chain.
Now derived consistently from the memfile header's Metadata.BaseBuildId
in all three upload paths:
- Sandbox pause/checkpoint: read from snapshot.MemfileDiffHeader
- Template layer build: read from snapshot.MemfileDiffHeader after pause
- Optimize phase rewrite: read from the cached template's memfile header
If the header doesn't carry a usable base build ID, root_build_id is
omitted from the labels rather than falling back to a wrong value.
* Strip lineage labels: keep only team_id on uploaded objects
0 commit comments