-
feat(cli): deterministic image builds for deployments (#2778)
发布于
2025-12-12 08:48:04 +00:00 | 1300 次提交 在此版本后已推送到 mainThis PR makes our image builds deterministic and reproducible by
ensuring that identical source code always produces the same image
layers and image digest. This means that deployments where nothing has
changed will no longer invalidate the image cache in our worker cluster
nodes, thus avoid making the cold starts for runs worse.Context
New deployments currently increase the cold start times for runs, as
they generate a new image which needs to be pulled in the worker cluster
where runs are executed. It happens also when the source code for the
deployment has not changed due to non-deterministic steps in our build
system. This addresses the latter issue by making builds reproducible.Main changes
- Avoided baking
TRIGGER_DEPLOYMENT_IDand
TRIGGER_DEPLOYMENT_VERSIONin the image, we now pass these via the
supervisor instead. - Used
json-stable-stringifyfor consistent key ordering in the files
we generate for the build, e.g.,package.json,build.json,
index.json. - Removed
metafile.jsonfrom the image contents as it is not actually
used in the container. This is only relevant for theanalyzecommand. - Added
SOURCE_DATE_EPOCH=0andrewrite-timestamp=trueto Docker
builds to normalize file timestamps. - Removed some
timingsandoutputHashesfrom build outputs and
manifests.
The builds are now reproducible for both native build server and Depot
paths. This should also lead to better image layer cache reuse in
general.下载附件
- Avoided baking