Skip to content

Commit

Permalink
fix: default to legacy builder instead of BuildKit with podman
Browse files Browse the repository at this point in the history
- Podman doesn't support all buildkit features.
- Podman main branch is now always defaulting to "DOCKER_BUILDKIT=0", See https://github.com/containers/podman/blob/f7be7a365ad3e90db5f96f269a555f6f380f9275/cmd/podman/compose.go#L164
- fix: make cli ignore `--buildkit` parameter and default to `never` when Podman is used.
  • Loading branch information
eqladios committed Nov 1, 2024
1 parent 96835f3 commit 3a80b14
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/spec-node/devContainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { createNullLifecycleHook, finishBackgroundTasks, ResolverParameters, Use
import { GoARCH, GoOS, getCLIHost, loadNativeModule } from '../spec-common/commonUtils';
import { resolve } from './configContainer';
import { URI } from 'vscode-uri';
import { LogLevel, LogDimensions, toErrorText, createCombinedLog, createTerminalLog, Log, makeLog, LogFormat, createJSONLog, createPlainLog, LogHandler, replaceAllLog } from '../spec-utils/log';
import { LogLevel, LogDimensions, toErrorText, toWarningText, createCombinedLog, createTerminalLog, Log, makeLog, LogFormat, createJSONLog, createPlainLog, LogHandler, replaceAllLog } from '../spec-utils/log';
import { dockerComposeCLIConfig } from './dockerCompose';
import { Mount } from '../spec-configuration/containerFeaturesConfiguration';
import { getPackageConfig, PackageConfiguration } from '../spec-utils/product';
Expand Down Expand Up @@ -197,14 +197,18 @@ export async function createDockerParams(options: ProvisionOptions, disposables:
}
})();

const buildKitVersion = options.useBuildKit === 'never' ? undefined : (await dockerBuildKitVersion({
cliHost,
dockerCLI: dockerPath,
dockerComposeCLI,
env: cliHost.env,
output,
platformInfo
}));
const buildKitVersion = async () => {
if (options.useBuildKit === 'never') {
return undefined;
} else {
if (await isPodman({ exec: cliHost.exec, cmd: dockerPath, env: cliHost.env, output })) {
output.write(toWarningText('Podman does not support BuildKit, defaulting to legacy builder.'));
return undefined;
}
return await dockerBuildKitVersion({ cliHost, dockerCLI: dockerPath, dockerComposeCLI, env: cliHost.env, output, platformInfo });
}
};

return {
common,
parsedAuthority,
Expand All @@ -224,7 +228,7 @@ export async function createDockerParams(options: ProvisionOptions, disposables:
userRepositoryConfigurationPaths: [],
updateRemoteUserUIDDefault,
additionalCacheFroms: options.additionalCacheFroms,
buildKitVersion,
buildKitVersion: await buildKitVersion(),
isTTY: process.stdout.isTTY || options.logFormat === 'json',
experimentalLockfile,
experimentalFrozenLockfile,
Expand Down

0 comments on commit 3a80b14

Please sign in to comment.