fix(cli): fix --load flag on local/self-hosted builds
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Fix `--load` flag being silently ignored on local/self-hosted builds.
|
||||
@@ -205,6 +205,7 @@ async function remoteBuildImage(options: DepotBuildImageOptions): Promise<BuildI
|
||||
compression: options.compression,
|
||||
compressionLevel: options.compressionLevel,
|
||||
forceCompression: options.forceCompression,
|
||||
isLocalBuild: false,
|
||||
});
|
||||
|
||||
const args = [
|
||||
@@ -538,6 +539,7 @@ async function localBuildImage(options: SelfHostedBuildImageOptions): Promise<Bu
|
||||
compression,
|
||||
compressionLevel,
|
||||
forceCompression,
|
||||
isLocalBuild: true,
|
||||
});
|
||||
|
||||
const args = [
|
||||
@@ -1123,6 +1125,7 @@ function getOutputOptions({
|
||||
compression,
|
||||
compressionLevel,
|
||||
forceCompression,
|
||||
isLocalBuild,
|
||||
}: {
|
||||
imageTag?: string;
|
||||
push?: boolean;
|
||||
@@ -1130,8 +1133,25 @@ function getOutputOptions({
|
||||
compression?: "zstd" | "gzip";
|
||||
compressionLevel?: number;
|
||||
forceCompression?: boolean;
|
||||
isLocalBuild: boolean;
|
||||
}): string[] {
|
||||
// Always use OCI media types for compatibility
|
||||
// type=docker exports directly into the local Docker daemon (what --load does).
|
||||
// type=image builds a registry-format image that can be pushed.
|
||||
// They're mutually exclusive: type=docker doesn't support push/compression,
|
||||
// and type=image silently ignores "load=true".
|
||||
// Only use type=docker for local builds to avoid affecting remote builds.
|
||||
// Note: type=docker doesn't support compression options or rewrite-timestamp,
|
||||
// so it will use the actual build time and default compression.
|
||||
if (isLocalBuild && load && !push) {
|
||||
const outputOptions: string[] = ["type=docker"];
|
||||
|
||||
if (imageTag) {
|
||||
outputOptions.push(`name=${imageTag}`);
|
||||
}
|
||||
|
||||
return outputOptions;
|
||||
}
|
||||
|
||||
const outputOptions: string[] = ["type=image", "oci-mediatypes=true", "rewrite-timestamp=true"];
|
||||
|
||||
if (imageTag) {
|
||||
@@ -1142,10 +1162,6 @@ function getOutputOptions({
|
||||
outputOptions.push("push=true");
|
||||
}
|
||||
|
||||
if (load) {
|
||||
outputOptions.push("load=true");
|
||||
}
|
||||
|
||||
// Only add compression args when using zstd (gzip is the default, no args needed)
|
||||
if (compression === "zstd") {
|
||||
outputOptions.push("compression=zstd");
|
||||
|
||||
Reference in New Issue
Block a user