Skip to content

Commit

Permalink
Prep for 0.9.1 release (#392)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ejizba authored May 23, 2018
1 parent c2ba82f commit 2839462
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 63 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

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

## 0.9.1 - 2018-05-23

### [Fixed](https://github.com/Microsoft/vscode-azurefunctions/issues?q=is%3Aissue+milestone%3A%220.9.1%22+label%3Abug+is%3Aclosed)

- Users will not be prompted to install the latest version of the func cli if high priority issues are discovered
- 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)

## 0.9.0 - 2018-05-09

### Added
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-azurefunctions",
"displayName": "Azure Functions",
"description": "%extension.description%",
"version": "0.9.0",
"version": "0.9.1",
"publisher": "ms-azuretools",
"icon": "resources/azure-functions.png",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
Expand Down Expand Up @@ -642,7 +642,7 @@
"semver": "^5.5.0",
"vscode-azureappservice": "~0.16.0",
"vscode-azureextensionui": "~0.13.0",
"vscode-azurekudu": "~0.1.7",
"vscode-azurekudu": "0.1.7",
"vscode-extension-telemetry": "^0.0.15",
"vscode-nls": "^2.0.2",
"websocket": "^1.0.25",
Expand Down
120 changes: 59 additions & 61 deletions src/utils/functionRuntimeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,61 +28,54 @@ export namespace functionRuntimeUtils {
this.properties.isActivationEvent = 'true';
const settingKey: string = 'showCoreToolsWarning';
if (getFuncExtensionSetting<boolean>(settingKey)) {
try {
const localVersion: string | null = await getLocalFunctionRuntimeVersion();
if (localVersion === null) {
return;
}
this.properties.localVersion = localVersion;
const major: number = semver.major(localVersion);
const newestVersion: string | null = await getNewestFunctionRuntimeVersion(major);
if (newestVersion === null) {
return;
}
const localVersion: string | null = await getLocalFunctionRuntimeVersion();
if (localVersion === null) {
return;
}
this.properties.localVersion = localVersion;
const major: number = semver.major(localVersion);
const newestVersion: string | undefined = await getNewestFunctionRuntimeVersion(major, this);
if (!newestVersion) {
return;
}

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

do {
result = packageManager !== undefined ? await ext.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain) :
await ext.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
if (result === DialogResponses.learnMore) {
// tslint:disable-next-line:no-unsafe-any
opn('https://aka.ms/azFuncOutdated');
} else if (result === update) {
switch (major) {
case FunctionRuntimeTag.latest:
// tslint:disable-next-line:no-non-null-assertion
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v1');
case FunctionRuntimeTag.core:
// tslint:disable-next-line:no-non-null-assertion
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v2');
default:
break;
}
} else if (result === DialogResponses.dontWarnAgain) {
await updateGlobalSetting(settingKey, false);
do {
result = packageManager !== undefined ? await ext.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain) :
await ext.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
if (result === DialogResponses.learnMore) {
// tslint:disable-next-line:no-unsafe-any
opn('https://aka.ms/azFuncOutdated');
} else if (result === update) {
switch (major) {
case FunctionRuntimeTag.latest:
// tslint:disable-next-line:no-non-null-assertion
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v1');
case FunctionRuntimeTag.core:
// tslint:disable-next-line:no-non-null-assertion
await attemptToInstallLatestFunctionRuntime(packageManager!, 'v2');
default:
break;
}
} else if (result === DialogResponses.dontWarnAgain) {
await updateGlobalSetting(settingKey, false);
}
while (result === DialogResponses.learnMore);
}
} catch (error) {
if (!parseError(error).isUserCancelledError) {
ext.outputChannel.appendLine(`Error occurred when checking the version of 'Azure Functions Core Tools': ${parseError(error).message}`);
throw error;
}
while (result === DialogResponses.learnMore);
}
}
});
Expand Down Expand Up @@ -127,17 +120,22 @@ export namespace functionRuntimeUtils {
return null;
}

async function getNewestFunctionRuntimeVersion(major: number): Promise<string | null> {
const npmRegistryUri: string = 'https://aka.ms/W2mvv3';
type distTags = { core: string, docker: string, latest: string };
const distTags: distTags = <distTags>JSON.parse((await <Thenable<string>>request(npmRegistryUri).promise()));
switch (major) {
case FunctionRuntimeTag.latest:
return distTags.latest;
case FunctionRuntimeTag.core:
return distTags.core;
default:
return null;
async function getNewestFunctionRuntimeVersion(major: number, actionContext: IActionContext): Promise<string | undefined> {
try {
const npmRegistryUri: string = 'https://aka.ms/W2mvv3';
type distTags = { core: string, docker: string, latest: string };
const distTags: distTags = <distTags>JSON.parse((await <Thenable<string>>request(npmRegistryUri).promise()));
switch (major) {
case FunctionRuntimeTag.latest:
return distTags.latest;
case FunctionRuntimeTag.core:
return distTags.core;
default:
}
} catch (error) {
actionContext.properties.latestRuntimeError = parseError(error).message;
}

return undefined;
}
}

0 comments on commit 2839462

Please sign in to comment.