From ff119dabf722c31667c613c4d26aac1c22c9a65e Mon Sep 17 00:00:00 2001 From: Jim Ehrismann <40840436+jim-docker@users.noreply.github.com> Date: Wed, 27 Apr 2022 11:55:23 -0400 Subject: [PATCH] adding https_proxy to execHelm env (#5273) * adding https_proxy to execHelm env Signed-off-by: Jim Ehrismann * lint plus simplification Signed-off-by: Jim Ehrismann --- src/main/helm/exec.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/helm/exec.ts b/src/main/helm/exec.ts index 8d8d0d4340..5d0305b2f6 100644 --- a/src/main/helm/exec.ts +++ b/src/main/helm/exec.ts @@ -7,6 +7,7 @@ import { promiseExecFile } from "../../common/utils/promise-exec"; import type { BaseEncodingOptions } from "fs"; import type { ExecFileOptions } from "child_process"; import { helmBinaryPath } from "../../common/vars"; +import { UserStore } from "../../common/user-store"; /** * ExecFile the bundled helm CLI @@ -14,7 +15,15 @@ import { helmBinaryPath } from "../../common/vars"; */ export async function execHelm(args: string[], options?: BaseEncodingOptions & ExecFileOptions): Promise { try { - const { stdout } = await promiseExecFile(helmBinaryPath.get(), args, options); + const opts = { ...options }; + + opts.env ??= process.env; + + if (!opts.env.HTTPS_PROXY && UserStore.getInstance().httpsProxy) { + opts.env.HTTPS_PROXY = UserStore.getInstance().httpsProxy; + } + + const { stdout } = await promiseExecFile(helmBinaryPath.get(), args, opts); return stdout; } catch (error) {