Skip to content

Commit 317c668

Browse files
committed
fix: pin version of log aggregator to version of codeflare
1 parent fca20c4 commit 317c668

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

Diff for: plugins/plugin-codeflare/src/controller/catchall.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { version } from "@kui-shell/client/package.json"
1718
import { doMadwizard } from "@kui-shell/plugin-madwizard"
1819

20+
/** Extra environment variables for the madwizard run */
21+
function env() {
22+
return {
23+
// sync/pin log aggregator version to our version
24+
LOG_AGGREGATOR_TAG: version,
25+
}
26+
}
27+
1928
/**
2029
* Our catch-all command handler: send to madwizard.
2130
*/
22-
export default doMadwizard(true, "guide", true)
31+
export default doMadwizard(true, "guide", true, undefined, env)

Diff for: plugins/plugin-codeflare/src/tray/menus/profiles/log-aggregator.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,20 @@
1717
import { CreateWindowFunction } from "@kui-shell/core"
1818

1919
import windowOptions from "../../window"
20+
import { bootIcon, shutDownIcon } from "../../icons"
2021

2122
/** Handler for redeploying the server-side log aggregator up a profile */
22-
async function stopLogAggregator(profile: string, createWindow: CreateWindowFunction) {
23+
async function logAggregator(task: "deploy" | "undeploy", profile: string, createWindow: CreateWindowFunction) {
2324
createWindow(
2425
// re: -y, this means run in non-interactive mode (-y is short for --yes)
25-
["codeflare", "gui", "guide", "-y", "--profile", profile, "ml/ray/aggregator/in-cluster/client-side/undeploy"],
26+
["codeflare", "gui", "guide", "-y", "--profile", profile, `ml/ray/aggregator/in-cluster/client-side/${task}`],
2627
windowOptions({ title: "Stopping Log Aggregator " + profile })
2728
)
2829
}
2930

3031
export default function bootMenuItem(profile: string, createWindow: CreateWindowFunction) {
31-
return { label: "Stop Log Aggregator", click: () => stopLogAggregator(profile, createWindow) }
32+
return [
33+
{ label: "Start Log Aggregator", icon: bootIcon, click: () => logAggregator("deploy", profile, createWindow) },
34+
{ label: "Stop Log Aggregator", icon: shutDownIcon, click: () => logAggregator("undeploy", profile, createWindow) },
35+
]
3236
}

Diff for: plugins/plugin-codeflare/src/tray/menus/profiles/tasks.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717
import { MenuItemConstructorOptions } from "electron"
1818
import { CreateWindowFunction } from "@kui-shell/core"
1919

20+
import section from "../section"
21+
2022
import boot from "./boot"
2123
import shutdown from "./shutdown"
22-
import stopLogAggregator from "./log-aggregator"
24+
import logAggregator from "./log-aggregator"
2325

2426
export default function tasks(profile: string, createWindow: CreateWindowFunction): MenuItemConstructorOptions[] {
2527
return [
2628
boot(profile, createWindow),
2729
shutdown(profile, createWindow),
2830
{
2931
label: "Advanced",
30-
submenu: [stopLogAggregator(profile, createWindow)],
32+
submenu: [...section("Log Aggregator", logAggregator(profile, createWindow))],
3133
},
3234
]
3335
}

Diff for: plugins/plugin-madwizard/src/plugin.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,24 @@ export function doMadwizard(
6161
readonly: boolean,
6262
task: Task,
6363
withFilepath = false,
64-
cb?: (filepath: string, tab: Tab) => Promise<true | ReactResponse["react"]>
64+
cb?: (filepath: string, tab: Tab) => Promise<true | ReactResponse["react"]>,
65+
66+
/** Inject environment variables into the madwizard run */
67+
envFn?: () => Record<string, string>
6568
) {
6669
return async ({ tab, argvNoOptions, parsedOptions }: Arguments<Options>) => {
6770
if (withFilepath && !argvNoOptions[1]) {
6871
// TODO codeflare should not be in plugin-madwizard
6972
argvNoOptions.push(process.env.GUIDEBOOK || "ml/codeflare")
7073
}
7174

75+
if (envFn) {
76+
// TODO add support to madwizard!
77+
Object.entries(envFn()).forEach(([key, value]) => {
78+
process.env[key] = value
79+
})
80+
}
81+
7282
if (!parsedOptions.u) {
7383
// CLI path
7484
const { cli } = await import("madwizard/dist/fe/cli/index.js")

0 commit comments

Comments
 (0)