1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/helm/exec.ts
Sebastian Malton a19f094a0d
Consolidate downloading binaries into one script (#4942)
* Consolidate downloading binaries into one script

- Upgrade lens-k8s-proxy to 0.1.5 which allows us to remove the trailing
  slash in KubeAuthProxy

- Consolidate nromalizing arch and os strings

- Remove LensBinary as HelmCli is not just a raw object since it is
  always bundled

- Introduce OnceCell and use it for the binary paths

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fully remove helmCli, move associated variable to vars

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix helm downloading on windows

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Don't download binaries for unsupported windows

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Arch specific paths

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix downloading helm on windows

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* rename once-cell file to lazy-initialized

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-03-09 17:51:51 -05:00

24 lines
715 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { promiseExecFile } from "../../common/utils/promise-exec";
import type { BaseEncodingOptions } from "fs";
import type { ExecFileOptions } from "child_process";
import { helmBinaryPath } from "../../common/vars";
/**
* ExecFile the bundled helm CLI
* @returns STDOUT
*/
export async function execHelm(args: string[], options?: BaseEncodingOptions & ExecFileOptions): Promise<string> {
try {
const { stdout } = await promiseExecFile(helmBinaryPath.get(), args, options);
return stdout;
} catch (error) {
throw error?.stderr || error;
}
}