-
Notifications
You must be signed in to change notification settings - Fork 73
Add configs to manage CPU architecture for Choreo CLI and skip keyring for auth management #1376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -52,10 +52,12 @@ export const getChoreoEnv = (): string => { | |||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const getChoreoBinPath = () => { | ||||||||||||||||||||||||||||||
| return path.join(ext.context.globalStorageUri.fsPath, "choreo-cli-rpc", getCliVersion(), "bin"); | ||||||||||||||||||||||||||||||
| const OS = os.platform(); | ||||||||||||||||||||||||||||||
| const ARCH = getArchitecture(); | ||||||||||||||||||||||||||||||
| return path.join(ext.context.extensionPath, "resources", "choreo-cli", getCliVersion(), OS, ARCH, "bin"); | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| export const downloadCLI = async () => { | ||||||||||||||||||||||||||||||
| export const installCLI = async () => { | ||||||||||||||||||||||||||||||
| const OS = os.platform(); | ||||||||||||||||||||||||||||||
| const ARCH = getArchitecture(); | ||||||||||||||||||||||||||||||
| const CHOREO_BIN_DIR = getChoreoBinPath(); | ||||||||||||||||||||||||||||||
|
|
@@ -167,6 +169,10 @@ export const downloadCLI = async () => { | |||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| function getArchitecture() { | ||||||||||||||||||||||||||||||
| const arch = workspace.getConfiguration().get<string>("WSO2.WSO2-Platform.Advanced.RpcArchitecture"); | ||||||||||||||||||||||||||||||
| if (arch) { | ||||||||||||||||||||||||||||||
| return arch; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Comment on lines
171
to
+175
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validate architecture overrides. 🛡️ Suggested validation function getArchitecture() {
const arch = workspace.getConfiguration().get<string>("WSO2.WSO2-Platform.Advanced.RpcArchitecture");
if (arch) {
+ const allowed = new Set(["amd64", "arm64", "arm"]);
+ if (!allowed.has(arch)) {
+ throw new Error(`Unsupported architecture override: ${arch}. Expected one of: ${[...allowed].join(", ")}`);
+ }
return arch;
}
const ARCH = os.arch();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| const ARCH = os.arch(); | ||||||||||||||||||||||||||||||
| switch (ARCH) { | ||||||||||||||||||||||||||||||
| case "x64": | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ import { ext } from "../extensionVariables"; | |
| import { getLogger } from "../logger/logger"; | ||
| import { parseJwt } from "../utils"; | ||
| import { getChoreoExecPath } from "./cli-install"; | ||
| import { workspace } from "vscode"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honor explicit false for SkipKeyring. ✅ Proposed fix- const skipKeyringConfig = workspace.getConfiguration().get<boolean>("WSO2.WSO2-Platform.Advanced.SkipKeyring");
+ const skipKeyringConfig = workspace.getConfiguration().get<boolean>("WSO2.WSO2-Platform.Advanced.SkipKeyring");
+ const skipKeyring =
+ skipKeyringConfig !== undefined
+ ? skipKeyringConfig
+ : ext.isDevantCloudEditor
+ ? true
+ : undefined;
this._serverProcess = spawn(executablePath, ["start-rpc-server"], {
env: {
...process.env,
- SKIP_KEYRING: (skipKeyringConfig || ext.isDevantCloudEditor) ? "true" : (process.env.SKIP_KEYRING || ""),
+ SKIP_KEYRING: skipKeyring === undefined ? (process.env.SKIP_KEYRING || "") : (skipKeyring ? "true" : ""),
CHOREO_ENV: ext.choreoEnv,
CHOREO_REGION: region,
},
});Also applies to: 47-52 🤖 Prompt for AI Agents |
||
|
|
||
| export class StdioConnection { | ||
| private _connection: MessageConnection; | ||
|
|
@@ -43,10 +44,11 @@ export class StdioConnection { | |
| if (!region && process.env.CLOUD_STS_TOKEN && parseJwt(process.env.CLOUD_STS_TOKEN)?.iss?.includes(".eu.")) { | ||
| region = "EU"; | ||
| } | ||
| const skipKeyringConfig = workspace.getConfiguration().get<boolean>("WSO2.WSO2-Platform.Advanced.SkipKeyring"); | ||
| this._serverProcess = spawn(executablePath, ["start-rpc-server"], { | ||
| env: { | ||
| ...process.env, | ||
| SKIP_KEYRING: ext.isDevantCloudEditor ? "true" : "", | ||
| SKIP_KEYRING: (skipKeyringConfig || ext.isDevantCloudEditor) ? "true" : (process.env.SKIP_KEYRING || ""), | ||
| CHOREO_ENV: ext.choreoEnv, | ||
| CHOREO_REGION: region, | ||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify the SkipKeyring setting description.
Current text is grammatically unclear and can confuse users.
✏️ Proposed text fix
📝 Committable suggestion
🤖 Prompt for AI Agents