6d6ed471d1
⚒️ Publish Worker (v4) / build (supervisor) (push) Has been cancelled
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.