Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function getBuildx(version: string): Promise {
const selected = await determineVersion(version);
if (selected) {
version = selected;
}
const cliPluginsDir = path.join(os.homedir(), '.docker', 'cli-plugins');
const pluginName = osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx';
const downloadUrl = util.format(
'https://github.com/docker/buildx/releases/download/%s/%s',
version,
getFileName(version)
);
console.log(`⬇️ Downloading ${downloadUrl}...`);
await download.default(downloadUrl, cliPluginsDir, {filename: pluginName});
if (osPlat !== 'win32') {
await exec.exec('chmod', ['a+x', path.join(cliPluginsDir, pluginName)]);
}
return path.join(cliPluginsDir, pluginName);
}