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:
parent
d1a7e034d7
commit
2d4d8e35c9
@ -154,11 +154,6 @@ class HelmDownloader extends BinaryDownloader {
|
|||||||
|
|
||||||
type SupportedPlatform = "darwin" | "linux" | "windows";
|
type SupportedPlatform = "darwin" | "linux" | "windows";
|
||||||
|
|
||||||
interface SupportedArch {
|
|
||||||
downloadArch: string;
|
|
||||||
fileArch: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const multiBar = new MultiBar({
|
const multiBar = new MultiBar({
|
||||||
align: "left",
|
align: "left",
|
||||||
@ -169,44 +164,68 @@ async function main() {
|
|||||||
format: "[{bar}] {percentage}% | {downloadArch} {binaryName}",
|
format: "[{bar}] {percentage}% | {downloadArch} {binaryName}",
|
||||||
});
|
});
|
||||||
const baseDir = path.join(__dirname, "..", "binaries", "client");
|
const baseDir = path.join(__dirname, "..", "binaries", "client");
|
||||||
const supportedArchitectures: SupportedArch[] = [
|
const downloaders: BinaryDownloader[] = [
|
||||||
{
|
new LensK8sProxyDownloader({
|
||||||
|
version: packageInfo.config.k8sProxyVersion,
|
||||||
|
platform: normalizedPlatform,
|
||||||
downloadArch: "amd64",
|
downloadArch: "amd64",
|
||||||
fileArch: "x64",
|
fileArch: "x64",
|
||||||
},
|
baseDir,
|
||||||
normalizedPlatform === "windows"
|
}, multiBar),
|
||||||
? {
|
new KubectlDownloader({
|
||||||
downloadArch: "386",
|
version: packageInfo.config.bundledKubectlVersion,
|
||||||
fileArch: "ia32",
|
platform: normalizedPlatform,
|
||||||
}
|
downloadArch: "amd64",
|
||||||
: {
|
fileArch: "x64",
|
||||||
downloadArch: "arm64",
|
baseDir,
|
||||||
fileArch: "arm64",
|
}, 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(
|
downloaders.push(
|
||||||
new LensK8sProxyDownloader({
|
new LensK8sProxyDownloader({
|
||||||
version: packageInfo.config.k8sProxyVersion,
|
version: packageInfo.config.k8sProxyVersion,
|
||||||
platform: normalizedPlatform,
|
platform: normalizedPlatform,
|
||||||
downloadArch,
|
downloadArch: "386",
|
||||||
fileArch,
|
fileArch: "ia32",
|
||||||
baseDir,
|
baseDir,
|
||||||
}, multiBar),
|
}, multiBar),
|
||||||
new KubectlDownloader({
|
new KubectlDownloader({
|
||||||
version: packageInfo.config.bundledKubectlVersion,
|
version: packageInfo.config.bundledKubectlVersion,
|
||||||
platform: normalizedPlatform,
|
platform: normalizedPlatform,
|
||||||
downloadArch,
|
downloadArch: "386",
|
||||||
fileArch,
|
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,
|
baseDir,
|
||||||
}, multiBar),
|
}, multiBar),
|
||||||
new HelmDownloader({
|
new HelmDownloader({
|
||||||
version: packageInfo.config.bundledHelmVersion,
|
version: packageInfo.config.bundledHelmVersion,
|
||||||
platform: normalizedPlatform,
|
platform: normalizedPlatform,
|
||||||
downloadArch,
|
downloadArch: "arm64",
|
||||||
fileArch,
|
fileArch: "arm64",
|
||||||
baseDir,
|
baseDir,
|
||||||
}, multiBar),
|
}, multiBar),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -133,7 +133,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"from": "binaries/client/linux/${arch}/helm",
|
"from": "binaries/client/linux/${arch}/helm",
|
||||||
"to": "./${arch}/helm"
|
"to": "./helm"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -158,7 +158,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"from": "binaries/client/darwin/${arch}/helm",
|
"from": "binaries/client/darwin/${arch}/helm",
|
||||||
"to": "./${arch}/helm"
|
"to": "./helm"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -185,7 +185,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"from": "binaries/client/windows/x64/helm.exe",
|
"from": "binaries/client/windows/x64/helm.exe",
|
||||||
"to": "./x64/helm.exe"
|
"to": "./helm.exe"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -66,17 +66,16 @@ export function getBinaryName(name: string, { forPlatform = normalizedPlatform }
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const baseBinariesDir = onceCell(() => (
|
export const resourcesDir = onceCell(() => (
|
||||||
path.join(
|
isProduction
|
||||||
isProduction
|
? process.resourcesPath
|
||||||
? process.resourcesPath
|
: path.join(process.cwd(), "binaries", "client", normalizedPlatform)
|
||||||
: path.join(process.cwd(), "binaries", "client", normalizedPlatform),
|
|
||||||
normalizedArch,
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
|
export const baseBinariesDir = onceCell(() => path.join(resourcesDir.get(), normalizedArch));
|
||||||
|
|
||||||
export const helmBinaryName = getBinaryName("helm");
|
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 kubectlBinaryName = getBinaryName("kubectl");
|
||||||
export const kubectlBinaryPath = onceCell(() => path.join(baseBinariesDir.get(), kubectlBinaryName));
|
export const kubectlBinaryPath = onceCell(() => path.join(baseBinariesDir.get(), kubectlBinaryName));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user