1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Fix helm downloading on windows

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-03-01 12:45:55 -05:00
parent d1a7e034d7
commit 2d4d8e35c9
3 changed files with 54 additions and 36 deletions

View File

@ -154,11 +154,6 @@ class HelmDownloader extends BinaryDownloader {
type SupportedPlatform = "darwin" | "linux" | "windows";
interface SupportedArch {
downloadArch: string;
fileArch: string;
}
async function main() {
const multiBar = new MultiBar({
align: "left",
@ -169,44 +164,68 @@ async function main() {
format: "[{bar}] {percentage}% | {downloadArch} {binaryName}",
});
const baseDir = path.join(__dirname, "..", "binaries", "client");
const supportedArchitectures: SupportedArch[] = [
{
const downloaders: BinaryDownloader[] = [
new LensK8sProxyDownloader({
version: packageInfo.config.k8sProxyVersion,
platform: normalizedPlatform,
downloadArch: "amd64",
fileArch: "x64",
},
normalizedPlatform === "windows"
? {
downloadArch: "386",
fileArch: "ia32",
}
: {
downloadArch: "arm64",
fileArch: "arm64",
},
baseDir,
}, multiBar),
new KubectlDownloader({
version: packageInfo.config.bundledKubectlVersion,
platform: normalizedPlatform,
downloadArch: "amd64",
fileArch: "x64",
baseDir,
}, multiBar),
new HelmDownloader({
version: packageInfo.config.bundledHelmVersion,
platform: normalizedPlatform,
downloadArch: "amd64",
fileArch: "x64",
baseDir,
}, multiBar),
];
const downloaders: BinaryDownloader[] = [];
for (const { downloadArch, fileArch } of supportedArchitectures) {
if (normalizedPlatform === "windows") {
downloaders.push(
new LensK8sProxyDownloader({
version: packageInfo.config.k8sProxyVersion,
platform: normalizedPlatform,
downloadArch,
fileArch,
downloadArch: "386",
fileArch: "ia32",
baseDir,
}, multiBar),
new KubectlDownloader({
version: packageInfo.config.bundledKubectlVersion,
platform: normalizedPlatform,
downloadArch,
fileArch,
downloadArch: "386",
fileArch: "ia32",
baseDir,
}, multiBar),
);
} else {
downloaders.push(
new LensK8sProxyDownloader({
version: packageInfo.config.k8sProxyVersion,
platform: normalizedPlatform,
downloadArch: "arm64",
fileArch: "arm64",
baseDir,
}, multiBar),
new KubectlDownloader({
version: packageInfo.config.bundledKubectlVersion,
platform: normalizedPlatform,
downloadArch: "arm64",
fileArch: "arm64",
baseDir,
}, multiBar),
new HelmDownloader({
version: packageInfo.config.bundledHelmVersion,
platform: normalizedPlatform,
downloadArch,
fileArch,
downloadArch: "arm64",
fileArch: "arm64",
baseDir,
}, multiBar),
);

View File

@ -133,7 +133,7 @@
},
{
"from": "binaries/client/linux/${arch}/helm",
"to": "./${arch}/helm"
"to": "./helm"
}
]
},
@ -158,7 +158,7 @@
},
{
"from": "binaries/client/darwin/${arch}/helm",
"to": "./${arch}/helm"
"to": "./helm"
}
]
},
@ -185,7 +185,7 @@
},
{
"from": "binaries/client/windows/x64/helm.exe",
"to": "./x64/helm.exe"
"to": "./helm.exe"
}
]
},

View File

@ -66,17 +66,16 @@ export function getBinaryName(name: string, { forPlatform = normalizedPlatform }
return name;
}
export const baseBinariesDir = onceCell(() => (
path.join(
isProduction
? process.resourcesPath
: path.join(process.cwd(), "binaries", "client", normalizedPlatform),
normalizedArch,
)
export const resourcesDir = onceCell(() => (
isProduction
? process.resourcesPath
: path.join(process.cwd(), "binaries", "client", normalizedPlatform)
));
export const baseBinariesDir = onceCell(() => path.join(resourcesDir.get(), normalizedArch));
export const helmBinaryName = getBinaryName("helm");
export const helmBinaryPath = onceCell(() => path.join(baseBinariesDir.get(), helmBinaryName));
export const helmBinaryPath = onceCell(() => path.join(resourcesDir.get(), helmBinaryName));
export const kubectlBinaryName = getBinaryName("kubectl");
export const kubectlBinaryPath = onceCell(() => path.join(baseBinariesDir.get(), kubectlBinaryName));