Skip to content

Commit d29f481

Browse files
committed
devcontainers#299 Make cacheTo available to devcontainer up and make it independant of noCache
1 parent ef79e83 commit d29f481

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

common/src/dev-container-cli.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ async function devContainerBuild(
195195
args.additionalCacheFroms.forEach(cacheFrom =>
196196
commandArgs.push('--cache-from', cacheFrom),
197197
);
198-
if (args.cacheTo) {
199-
args.cacheTo.forEach(cacheTo =>
200-
commandArgs.push('--cache-to', cacheTo),
201-
);
202-
}
198+
}
199+
if (args.cacheTo) {
200+
args.cacheTo.forEach(cacheTo =>
201+
commandArgs.push('--cache-to', cacheTo),
202+
);
203203
}
204204
return await runSpecCliJsonCommand<DevContainerCliBuildResult>({
205205
args: commandArgs,
@@ -217,6 +217,7 @@ export interface DevContainerCliUpArgs {
217217
workspaceFolder: string;
218218
configFile: string | undefined;
219219
additionalCacheFroms?: string[];
220+
cacheTo?: string[];
220221
skipContainerUserIdUpdate?: boolean;
221222
env?: string[];
222223
userDataFolder?: string;
@@ -241,6 +242,11 @@ async function devContainerUp(
241242
commandArgs.push('--cache-from', cacheFrom),
242243
);
243244
}
245+
if (args.cacheTo) {
246+
args.cacheTo.forEach(cacheTo =>
247+
commandArgs.push('--cache-to', cacheTo),
248+
);
249+
}
244250
if (args.userDataFolder) {
245251
commandArgs.push("--user-data-folder", args.userDataFolder);
246252
}

common/src/docker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ async function buildImageBase(
8989
}
9090
cacheFrom.forEach(cacheValue => args.push('--cache-from', cacheValue));
9191
if (cacheTo) {
92-
cacheTo.forEach(cacheValue => args.push('--cache-to', cacheValue));
92+
coerceToArray(cacheTo).forEach(cacheValue =>
93+
args.push('--cache-to', cacheValue),
94+
);
9395
} else {
9496
args.push('--cache-to');
9597
args.push('type=inline');

0 commit comments

Comments
 (0)