发布

  • feat(cli): deterministic image builds for deployments (#2778)

    frostbyte_neo 发布于 2025-12-12 08:48:04 +00:00 | 1300 次提交 在此版本后已推送到 main

    This 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_ID and
      TRIGGER_DEPLOYMENT_VERSION in the image, we now pass these via the
      supervisor instead.
    • Used json-stable-stringify for consistent key ordering in the files
      we generate for the build, e.g., package.json, build.json,
      index.json.
    • Removed metafile.json from the image contents as it is not actually
      used in the container. This is only relevant for the analyze command.
    • Added SOURCE_DATE_EPOCH=0 and rewrite-timestamp=true to Docker
      builds to normalize file timestamps.
    • Removed some timings and outputHashes from 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.

    下载附件