Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cli-deploy-skip-rewrite-timestamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

Add `TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP=1` escape hatch for local self-hosted builds whose buildx driver doesn't support `rewrite-timestamp` alongside push (e.g. orbstack's default `docker` driver).
9 changes: 8 additions & 1 deletion packages/cli-v3/src/deploy/buildImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,14 @@ function getOutputOptions({
return outputOptions;
}

const outputOptions: string[] = ["type=image", "oci-mediatypes=true", "rewrite-timestamp=true"];
// `rewrite-timestamp` is incompatible with the buildx docker driver's
// implicit `unpack=true` on push (used by e.g. orbstack's default builder).
// Provide an env-var escape hatch so local-dev deploys can opt out.
const skipRewriteTimestamp = process.env.TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP === "1";
const outputOptions: string[] = ["type=image", "oci-mediatypes=true"];
if (!skipRewriteTimestamp) {
Comment on lines +1158 to +1160
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Scope the escape hatch to local builds only.

Line 1158 applies TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP globally, so remote builds can also skip rewrite-timestamp when the env var is set. That contradicts the local-only behavior described by this PR.

Proposed fix
-  const skipRewriteTimestamp = process.env.TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP === "1";
+  const skipRewriteTimestamp =
+    isLocalBuild && process.env.TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP === "1";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const skipRewriteTimestamp = process.env.TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP === "1";
const outputOptions: string[] = ["type=image", "oci-mediatypes=true"];
if (!skipRewriteTimestamp) {
const skipRewriteTimestamp =
isLocalBuild && process.env.TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP === "1";
const outputOptions: string[] = ["type=image", "oci-mediatypes=true"];
if (!skipRewriteTimestamp) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli-v3/src/deploy/buildImage.ts` around lines 1158 - 1160, The env
var check for TRIGGER_BUILD_SKIP_REWRITE_TIMESTAMP is currently applied globally
via skipRewriteTimestamp and modifies outputOptions; restrict this so the skip
only takes effect for local builds by combining the env check with the existing
local-build indicator (e.g., isLocalBuild, options.isLocal, or whichever
boolean/param denotes a local build in the surrounding code). Update the
conditional around outputOptions (the block that currently uses
skipRewriteTimestamp and adds/removes rewrite-timestamp) to require both the env
var and the local-build flag, ensuring remote builds cannot skip
rewrite-timestamp.

outputOptions.push("rewrite-timestamp=true");
}

if (imageTag) {
outputOptions.push(`name=${imageTag}`);
Expand Down
Loading