Skip to content

Commit 2839462

Browse files
authored
Prep for 0.9.1 release (#392)
The release is due to [this bug](#387), but doesn't actually fix the bug itself (the real fix needs to be in the func cli). However, this release mitigates the bug by giving us the ability to 'turn off' the prompt to install the latest func cli (since Nathan [just changed](#391) it to an aka.ms link). I did a few additional things: 1. Stop displaying errors in the output channel. I think they're more confusing than helpful (NOTE: `this.suppressErrorDisplay` is still on even though I removed the try/catch, so users will NOT see these errors) 1. Temporarily hard-code the kudu package to the version used with the last release. I want to keep changes as small as possible for this bug-fix release
1 parent c2ba82f commit 2839462

File tree

3 files changed

+68
-63
lines changed

3 files changed

+68
-63
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
All notable changes to the "azurefunctions" extension will be documented in this file.
66

7+
## 0.9.1 - 2018-05-23
8+
9+
### [Fixed](https://github.com/Microsoft/vscode-azurefunctions/issues?q=is%3Aissue+milestone%3A%220.9.1%22+label%3Abug+is%3Aclosed)
10+
11+
- Users will not be prompted to install the latest version of the func cli if high priority issues are discovered
12+
- For example, the latest version of the func cli (2.0.1-beta.26) [breaks JavaScript debugging](https://github.com/Microsoft/vscode-azurefunctions/issues/387)
13+
714
## 0.9.0 - 2018-05-09
815

916
### Added

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-azurefunctions",
33
"displayName": "Azure Functions",
44
"description": "%extension.description%",
5-
"version": "0.9.0",
5+
"version": "0.9.1",
66
"publisher": "ms-azuretools",
77
"icon": "resources/azure-functions.png",
88
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
@@ -642,7 +642,7 @@
642642
"semver": "^5.5.0",
643643
"vscode-azureappservice": "~0.16.0",
644644
"vscode-azureextensionui": "~0.13.0",
645-
"vscode-azurekudu": "~0.1.7",
645+
"vscode-azurekudu": "0.1.7",
646646
"vscode-extension-telemetry": "^0.0.15",
647647
"vscode-nls": "^2.0.2",
648648
"websocket": "^1.0.25",

src/utils/functionRuntimeUtils.ts

Lines changed: 59 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -28,61 +28,54 @@ export namespace functionRuntimeUtils {
2828
this.properties.isActivationEvent = 'true';
2929
const settingKey: string = 'showCoreToolsWarning';
3030
if (getFuncExtensionSetting<boolean>(settingKey)) {
31-
try {
32-
const localVersion: string | null = await getLocalFunctionRuntimeVersion();
33-
if (localVersion === null) {
34-
return;
35-
}
36-
this.properties.localVersion = localVersion;
37-
const major: number = semver.major(localVersion);
38-
const newestVersion: string | null = await getNewestFunctionRuntimeVersion(major);
39-
if (newestVersion === null) {
40-
return;
41-
}
31+
const localVersion: string | null = await getLocalFunctionRuntimeVersion();
32+
if (localVersion === null) {
33+
return;
34+
}
35+
this.properties.localVersion = localVersion;
36+
const major: number = semver.major(localVersion);
37+
const newestVersion: string | undefined = await getNewestFunctionRuntimeVersion(major, this);
38+
if (!newestVersion) {
39+
return;
40+
}
4241

43-
if (semver.gt(newestVersion, localVersion)) {
44-
const packageManager: PackageManager | undefined = await getFuncPackageManager(true /* isFuncInstalled */);
45-
let message: string = localize(
46-
'azFunc.outdatedFunctionRuntime',
47-
'Update your Azure Functions Core Tools ({0}) to the latest ({1}) for the best experience.',
48-
localVersion,
49-
newestVersion
50-
);
51-
const v2: string = localize('v2BreakingChanges', 'v2 is in preview and may have breaking changes (which are automatically applied to Azure).');
52-
if (major === FunctionRuntimeTag.core) {
53-
message += ` ${v2}`;
54-
}
55-
const update: vscode.MessageItem = { title: 'Update' };
56-
let result: vscode.MessageItem;
42+
if (semver.gt(newestVersion, localVersion)) {
43+
const packageManager: PackageManager | undefined = await getFuncPackageManager(true /* isFuncInstalled */);
44+
let message: string = localize(
45+
'azFunc.outdatedFunctionRuntime',
46+
'Update your Azure Functions Core Tools ({0}) to the latest ({1}) for the best experience.',
47+
localVersion,
48+
newestVersion
49+
);
50+
const v2: string = localize('v2BreakingChanges', 'v2 is in preview and may have breaking changes (which are automatically applied to Azure).');
51+
if (major === FunctionRuntimeTag.core) {
52+
message += ` ${v2}`;
53+
}
54+
const update: vscode.MessageItem = { title: 'Update' };
55+
let result: vscode.MessageItem;
5756

58-
do {
59-
result = packageManager !== undefined ? await ext.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain) :
60-
await ext.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
61-
if (result === DialogResponses.learnMore) {
62-
// tslint:disable-next-line:no-unsafe-any
63-
opn('https://aka.ms/azFuncOutdated');
64-
} else if (result === update) {
65-
switch (major) {
66-
case FunctionRuntimeTag.latest:
67-
// tslint:disable-next-line:no-non-null-assertion
68-
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v1');
69-
case FunctionRuntimeTag.core:
70-
// tslint:disable-next-line:no-non-null-assertion
71-
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v2');
72-
default:
73-
break;
74-
}
75-
} else if (result === DialogResponses.dontWarnAgain) {
76-
await updateGlobalSetting(settingKey, false);
57+
do {
58+
result = packageManager !== undefined ? await ext.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain) :
59+
await ext.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
60+
if (result === DialogResponses.learnMore) {
61+
// tslint:disable-next-line:no-unsafe-any
62+
opn('https://aka.ms/azFuncOutdated');
63+
} else if (result === update) {
64+
switch (major) {
65+
case FunctionRuntimeTag.latest:
66+
// tslint:disable-next-line:no-non-null-assertion
67+
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v1');
68+
case FunctionRuntimeTag.core:
69+
// tslint:disable-next-line:no-non-null-assertion
70+
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v2');
71+
default:
72+
break;
7773
}
74+
} else if (result === DialogResponses.dontWarnAgain) {
75+
await updateGlobalSetting(settingKey, false);
7876
}
79-
while (result === DialogResponses.learnMore);
80-
}
81-
} catch (error) {
82-
if (!parseError(error).isUserCancelledError) {
83-
ext.outputChannel.appendLine(`Error occurred when checking the version of 'Azure Functions Core Tools': ${parseError(error).message}`);
84-
throw error;
8577
}
78+
while (result === DialogResponses.learnMore);
8679
}
8780
}
8881
});
@@ -127,17 +120,22 @@ export namespace functionRuntimeUtils {
127120
return null;
128121
}
129122

130-
async function getNewestFunctionRuntimeVersion(major: number): Promise<string | null> {
131-
const npmRegistryUri: string = 'https://aka.ms/W2mvv3';
132-
type distTags = { core: string, docker: string, latest: string };
133-
const distTags: distTags = <distTags>JSON.parse((await <Thenable<string>>request(npmRegistryUri).promise()));
134-
switch (major) {
135-
case FunctionRuntimeTag.latest:
136-
return distTags.latest;
137-
case FunctionRuntimeTag.core:
138-
return distTags.core;
139-
default:
140-
return null;
123+
async function getNewestFunctionRuntimeVersion(major: number, actionContext: IActionContext): Promise<string | undefined> {
124+
try {
125+
const npmRegistryUri: string = 'https://aka.ms/W2mvv3';
126+
type distTags = { core: string, docker: string, latest: string };
127+
const distTags: distTags = <distTags>JSON.parse((await <Thenable<string>>request(npmRegistryUri).promise()));
128+
switch (major) {
129+
case FunctionRuntimeTag.latest:
130+
return distTags.latest;
131+
case FunctionRuntimeTag.core:
132+
return distTags.core;
133+
default:
134+
}
135+
} catch (error) {
136+
actionContext.properties.latestRuntimeError = parseError(error).message;
141137
}
138+
139+
return undefined;
142140
}
143141
}

0 commit comments

Comments
 (0)