Skip to content

Commit

Permalink
devcontainers#299 Make cacheTo available to devcontainer up and m…
Browse files Browse the repository at this point in the history
…ake it independant of `noCache`
  • Loading branch information
sebst committed Sep 3, 2024
1 parent ef79e83 commit d29f481
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 11 additions & 5 deletions common/src/dev-container-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ async function devContainerBuild(
args.additionalCacheFroms.forEach(cacheFrom =>
commandArgs.push('--cache-from', cacheFrom),
);
if (args.cacheTo) {
args.cacheTo.forEach(cacheTo =>
commandArgs.push('--cache-to', cacheTo),
);
}
}
if (args.cacheTo) {
args.cacheTo.forEach(cacheTo =>
commandArgs.push('--cache-to', cacheTo),
);
}
return await runSpecCliJsonCommand<DevContainerCliBuildResult>({
args: commandArgs,
Expand All @@ -217,6 +217,7 @@ export interface DevContainerCliUpArgs {
workspaceFolder: string;
configFile: string | undefined;
additionalCacheFroms?: string[];
cacheTo?: string[];
skipContainerUserIdUpdate?: boolean;
env?: string[];
userDataFolder?: string;
Expand All @@ -241,6 +242,11 @@ async function devContainerUp(
commandArgs.push('--cache-from', cacheFrom),
);
}
if (args.cacheTo) {
args.cacheTo.forEach(cacheTo =>
commandArgs.push('--cache-to', cacheTo),
);
}
if (args.userDataFolder) {
commandArgs.push("--user-data-folder", args.userDataFolder);
}
Expand Down
4 changes: 3 additions & 1 deletion common/src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ async function buildImageBase(
}
cacheFrom.forEach(cacheValue => args.push('--cache-from', cacheValue));
if (cacheTo) {
cacheTo.forEach(cacheValue => args.push('--cache-to', cacheValue));
coerceToArray(cacheTo).forEach(cacheValue =>
args.push('--cache-to', cacheValue),
);
} else {
args.push('--cache-to');
args.push('type=inline');
Expand Down

0 comments on commit d29f481

Please sign in to comment.