Skip to content

Commit c72dd52

Browse files
committed
Update odo to v2.1.0
This PR fixes #2100. Fix updates tools.json with new urls. checksums and version number. It includes preference.yaml file to use as default odo preferences with telemetry disabled to avoid confusing extension usage with real odo usage from command line interface. Every command executed gets environment variable GLOBALODOCONFIG initialized with path to default prefernce.yaml file. Signed-off-by: Denis Golovin dgolovin@redhat.com
1 parent 4b300d4 commit c72dd52

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

preference.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: Preference
2+
apiversion: odo.dev/v1alpha1
3+
OdoSettings:
4+
RegistryList:
5+
- Name: DefaultDevfileRegistry
6+
URL: https://github.com/odo-devfiles/registry
7+
secure: false
8+
ConsentTelemetry: false

src/odo.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,22 +736,29 @@ export class OdoImpl implements Odo {
736736
return services;
737737
}
738738

739+
public createEnv(): {} {
740+
const env = {...process.env };
741+
env.GLOBALODOCONFIG = path.resolve(__dirname,'..', '..', 'preference.yaml');
742+
return env;
743+
}
744+
739745
public async executeInTerminal(command: CommandText, cwd: string = process.cwd(), name = 'OpenShift'): Promise<void> {
740746
const [cmd] = `${command}`.split(' ');
741747
const toolLocation = await ToolsConfig.detect(cmd);
742-
const terminal: Terminal = WindowUtil.createTerminal(name, cwd);
748+
const terminal: Terminal = WindowUtil.createTerminal(name, cwd, this.createEnv());
743749
terminal.sendText(toolLocation === cmd ? `${command}` : `${command}`.replace(cmd, `"${toolLocation}"`), true);
744750
terminal.show();
745751
}
746752

747753
public async execute(command: CommandText, cwd?: string, fail = true): Promise<cliInstance.CliExitData> {
754+
const env = this.createEnv();
748755
const commandActual = `${command}`;
749756
const commandPrivacy = `${command.privacyMode(true)}`;
750757
const [cmd] = commandActual.split(' ');
751758
const toolLocation = await ToolsConfig.detect(cmd);
752759
const result: cliInstance.CliExitData = await OdoImpl.cli.execute(
753760
toolLocation ? commandActual.replace(cmd, `"${toolLocation}"`) : commandActual,
754-
cwd ? {cwd} : { }
761+
cwd ? {cwd, env} : { env }
755762
);
756763
if (result.error && fail) {
757764
throw new VsCommandError(`${result.error.message}`, `Error when running command: ${commandPrivacy}`, result.error);

src/tools.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
"description": "odo CLI",
44
"vendor": "Red Hat, Inc.",
55
"name": "odo",
6-
"version": "2.0.7",
7-
"versionRange": "^2.0.7",
8-
"versionRangeLabel": "version >= 2.0.7",
6+
"version": "2.1.0",
7+
"versionRange": "^2.1.0",
8+
"versionRangeLabel": "version >= 2.1.0",
99
"dlFileName": "odo",
1010
"filePrefix": "",
1111
"platform": {
1212
"win32": {
13-
"url": "https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.0.7/odo-windows-amd64.exe.zip",
14-
"sha256sum": "68a1ffd6034ed6ab92ece663a4c95310e2fc8b3c1d4723b31c1f85e6ad77ba2c",
13+
"url": "https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.1.0/odo-windows-amd64.exe.zip",
14+
"sha256sum": "77739939e2bbf1662b22fdee402b1a352b80ce3e84fa3dbe549ba532b1283de6",
1515
"dlFileName": "odo-windows-amd64.exe.zip",
1616
"cmdFileName": "odo.exe"
1717
},
1818
"darwin": {
19-
"url": "https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.0.7/odo-darwin-amd64.tar.gz",
20-
"sha256sum": "29fe926b4f45ad64eb5d4d555dbf94c4b87e0417520a5d9bd33bdbb25dee2be8",
19+
"url": "https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.1.0/odo-darwin-amd64.tar.gz",
20+
"sha256sum": "10f2b4f748bb33c3d4bd9486c62472e9ee51703709d2e4f235460ef5ff686b86",
2121
"dlFileName": "odo-darwin-amd64.tar.gz",
2222
"cmdFileName": "odo"
2323
},
2424
"linux": {
25-
"url": "https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.0.7/odo-linux-amd64.tar.gz",
26-
"sha256sum": "e36d27259cf15b34f9fc4303c429f7a52d817b086125ac41505b518a7c6fbd16",
25+
"url": "https://mirror.openshift.com/pub/openshift-v4/clients/odo/v2.1.0/odo-linux-amd64.tar.gz",
26+
"sha256sum": "46474a5979b2733b0ddb22eb34fd2f3920698566fd5b6a6188272b7e1e4fc7cb",
2727
"dlFileName": "odo-linux-amd64.tar.gz",
2828
"cmdFileName": "odo"
2929
}

src/util/windowUtils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
import { window, Terminal, TerminalOptions } from 'vscode';
77

88
export class WindowUtil {
9-
static createTerminal(name: string, cwd?: string): Terminal {
9+
static createTerminal(name: string, cwd?: string, env = process.env): Terminal {
10+
1011
const options: TerminalOptions = {
1112
cwd,
12-
name
13+
name,
14+
env
1315
};
1416
if (process.platform === 'win32') {
1517
options.shellPath = process.env.ComSpec;

0 commit comments

Comments
 (0)