mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-24 10:18:53 +00:00
fix: ensure PATH is correctly set for kind commands
fix https://github.com/containers/podman-desktop/issues/2088 Change-Id: I0f565bafa45db5872dcdfb0950e06b03e9fe3c3e Signed-off-by: Florent Benoit <fbenoit@redhat.com>
This commit is contained in:
parent
1d2351f7dd
commit
9e158e68d2
3 changed files with 8 additions and 4 deletions
|
|
@ -19,7 +19,7 @@ import * as extensionApi from '@podman-desktop/api';
|
|||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import * as os from 'node:os';
|
||||
import { runCliCommand } from './util';
|
||||
import { getKindPath, runCliCommand } from './util';
|
||||
import mustache from 'mustache';
|
||||
import { parseAllDocuments } from 'yaml';
|
||||
|
||||
|
|
@ -112,6 +112,9 @@ export async function createCluster(
|
|||
// ok we need to write the file
|
||||
await fs.promises.writeFile(tmpFilePath, kindClusterConfig, 'utf8');
|
||||
|
||||
// update PATH to include kind
|
||||
env.PATH = getKindPath();
|
||||
|
||||
// now execute the command to create the cluster
|
||||
try {
|
||||
await runCliCommand(kindCli, ['create', 'cluster', '--config', tmpFilePath], { env, logger }, token);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
***********************************************************************/
|
||||
|
||||
import * as extensionApi from '@podman-desktop/api';
|
||||
import { detectKind, runCliCommand } from './util';
|
||||
import { detectKind, getKindPath, runCliCommand } from './util';
|
||||
import { KindInstaller } from './kind-installer';
|
||||
import type { CancellationToken, Logger } from '@podman-desktop/api';
|
||||
import { window } from '@podman-desktop/api';
|
||||
|
|
@ -121,10 +121,11 @@ async function updateClusters(provider: extensionApi.Provider, containers: exten
|
|||
await extensionApi.containerEngine.stopContainer(cluster.engineId, cluster.id);
|
||||
},
|
||||
delete: async (logger): Promise<void> => {
|
||||
const env = process.env;
|
||||
const env = Object.assign({}, process.env);
|
||||
if (cluster.engineType === 'podman') {
|
||||
env['KIND_EXPERIMENTAL_PROVIDER'] = 'podman';
|
||||
}
|
||||
env.PATH = getKindPath();
|
||||
await runCliCommand(kindCli, ['delete', 'cluster', '--name', cluster.name], { env, logger });
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export interface RunOptions {
|
|||
logger?: extensionApi.Logger;
|
||||
}
|
||||
|
||||
const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin';
|
||||
const macosExtraPath = '/usr/local/bin:/opt/homebrew/bin:/opt/local/bin:/opt/podman/bin';
|
||||
|
||||
export function getKindPath(): string {
|
||||
const env = process.env;
|
||||
|
|
|
|||
Loading…
Reference in a new issue