diff --git a/package.json b/package.json
index b06a5829e4..fec24a0e0f 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"craco-alias": "3.0.1",
"craco-less": "1.20.0",
"cross-env": "7.0.3",
- "electron": "17.1.0",
+ "electron": "17.1.1",
"electron-builder": "23.0.0-alpha.3",
"electron-notarize": "1.1.1",
"electron-reload": "2.0.0-alpha.1",
diff --git a/src/components/molecules/PreviewConfigurationDetails/PreviewConfigurationDetails.tsx b/src/components/molecules/PreviewConfigurationDetails/PreviewConfigurationDetails.tsx
index 10923697ee..7304f07e81 100644
--- a/src/components/molecules/PreviewConfigurationDetails/PreviewConfigurationDetails.tsx
+++ b/src/components/molecules/PreviewConfigurationDetails/PreviewConfigurationDetails.tsx
@@ -43,7 +43,7 @@ const PreviwConfigurationDetails: React.FC = () => {
const builtCommand = useMemo(() => {
if (!previewConfiguration || !helmChart) {
- return '';
+ return [''];
}
return buildHelmCommand(
helmChart,
@@ -72,7 +72,7 @@ const PreviwConfigurationDetails: React.FC = () => {
)}
- {builtCommand}
+ {builtCommand.join(' ')}
);
diff --git a/src/redux/thunks/runPreviewConfiguration.ts b/src/redux/thunks/runPreviewConfiguration.ts
index fb7b25fe8f..c5e3c92634 100644
--- a/src/redux/thunks/runPreviewConfiguration.ts
+++ b/src/redux/thunks/runPreviewConfiguration.ts
@@ -1,7 +1,6 @@
import {createAsyncThunk} from '@reduxjs/toolkit';
import fs from 'fs';
-import log from 'loglevel';
import path from 'path';
import {ROOT_FILE_ENTRY} from '@constants/constants';
@@ -13,7 +12,8 @@ import {RootState} from '@models/rootstate';
import {SetPreviewDataPayload} from '@redux/reducers/main';
import {createPreviewResult, createRejectionWithAlert} from '@redux/thunks/utils';
-import {buildHelmCommand, runHelm} from '@utils/helm';
+import {CommandOptions, runCommandInMainThread} from '@utils/command';
+import {buildHelmCommand} from '@utils/helm';
/**
* Thunk to preview a Helm Chart
@@ -89,9 +89,7 @@ export const runPreviewConfiguration = createAsyncThunk<
);
}
- log.info(`Running the following Preview Configuration: ${previewConfiguration.id}`);
-
- const helmCommand = buildHelmCommand(
+ const args = buildHelmCommand(
chart,
previewConfiguration.orderedValuesFilePaths,
previewConfiguration.command,
@@ -100,12 +98,13 @@ export const runPreviewConfiguration = createAsyncThunk<
currentContext
);
- const args = {
- helmCommand,
- kubeconfig,
+ const commandOptions: CommandOptions = {
+ cmd: 'helm',
+ args: args.splice(1),
+ env: {KUBECONFIG: kubeconfig},
};
- const result = await runHelm(args);
+ const result = await runCommandInMainThread(commandOptions);
if (result.error) {
return createRejectionWithAlert(thunkAPI, 'Helm Error', result.error);
diff --git a/src/utils/helm.ts b/src/utils/helm.ts
index 84b3dc35cb..0cca4e8122 100644
--- a/src/utils/helm.ts
+++ b/src/utils/helm.ts
@@ -1,21 +1,7 @@
-import {ipcRenderer} from 'electron';
-
import path from 'path';
import {HelmChart} from '@models/helm';
-/**
- * Invokes Helm in main thread
- */
-export function runHelm(cmd: any): any {
- return new Promise(resolve => {
- ipcRenderer.once('helm-result', (event, arg) => {
- resolve(arg);
- });
- ipcRenderer.send('run-helm', cmd);
- });
-}
-
export function buildHelmCommand(
helmChart: HelmChart,
valuesFilePaths: string[],
@@ -23,7 +9,7 @@ export function buildHelmCommand(
options: Record,
rootFolderPath: string,
clusterContext?: string
-): string {
+): string[] {
const chartFolderPath = path.join(rootFolderPath, path.dirname(helmChart.filePath));
const args = [
@@ -44,5 +30,5 @@ export function buildHelmCommand(
args.push('--dry-run');
}
- return args.join(' ');
+ return args;
}