From 10392b65a3deacc1be1c6a16ed92b0c3bdd311e9 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Wed, 15 Mar 2023 16:11:42 -0400 Subject: [PATCH] Fix issue with login command where `PATH` isn't being modified (#1735) * Fix login command missing `PATH` entry * More info in changelog * Update CHANGELOG.md --------- Co-authored-by: Victor Vazquez --- ext/vscode/CHANGELOG.md | 18 ++++++++++++------ ext/vscode/package-lock.json | 4 ++-- ext/vscode/package.json | 2 +- ext/vscode/src/commands/loginCli.ts | 11 +++++++++-- ext/vscode/src/telemetry/telemetryId.ts | 3 +++ ext/vscode/src/utils/azureDevCli.ts | 7 ++++++- 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/ext/vscode/CHANGELOG.md b/ext/vscode/CHANGELOG.md index c71be31615a..7bffbe66a2e 100644 --- a/ext/vscode/CHANGELOG.md +++ b/ext/vscode/CHANGELOG.md @@ -1,41 +1,47 @@ # Release History -## 0.5.0-alpha.1 (Unreleased) - -### Features Added - -### Breaking Changes +## 0.4.2 (2023-03-15) ### Bugs Fixed -### Other Changes +- [[#1735]](https://github.com/Azure/azure-dev/pull/1735) Fixed an issue with the login command not working immediately after install. ## 0.4.1 (2023-03-14) + ### Bugs Fixed + - [[#1724]](https://github.com/Azure/azure-dev/pull/1724) Refine conditions for displaying the prompt to install the CLI. ## 0.4.0 (2023-03-08) + ### Added + - [[#853]](https://github.com/Azure/azure-dev/pull/853) Integration with the Azure Resources extension's workspace view. Requires version 0.6.1 of the [Azure Resources](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureresourcegroups) extension. - [[#1644]](https://github.com/Azure/azure-dev/pull/1644) Added a walkthrough experience for using the extension. ## 0.3.0 (2022-09-14) + ### Added + - [[#493]](https://github.com/Azure/azure-dev/pull/493) Show README file after successful init/up. ### Fixed + - [[#498]](https://github.com/Azure/azure-dev/pull/498) Use `azd template list` to populate template list in VS Code (now always consistent with the CLI). - [[#556]](https://github.com/Azure/azure-dev/pull/556) Improve error message when no environments are found. ## 0.2.0 (2022-08-02) ### Changed + - [[#189]](https://github.com/Azure/azure-dev/pull/189) Bump bicep minimum version to v0.8.9 ### Added + - [[#151]](https://github.com/Azure/azure-dev/pull/151) Detect and warn the user if `azd` CLI is not installed. ### Fixed + - [[#159]](https://github.com/Azure/azure-dev/pull/159) Enable user feedback via surveys. - [[#170]](https://github.com/Azure/azure-dev/pull/170) Enable gradual rollout of new features. diff --git a/ext/vscode/package-lock.json b/ext/vscode/package-lock.json index e4f099e08e7..48ad8974218 100644 --- a/ext/vscode/package-lock.json +++ b/ext/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "azure-dev", - "version": "0.5.0-alpha.1", + "version": "0.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "azure-dev", - "version": "0.5.0-alpha.1", + "version": "0.4.2", "license": "MIT", "dependencies": { "@microsoft/vscode-azext-utils": "~0.4", diff --git a/ext/vscode/package.json b/ext/vscode/package.json index f1405a77a72..3e27edfad50 100644 --- a/ext/vscode/package.json +++ b/ext/vscode/package.json @@ -2,7 +2,7 @@ "name": "azure-dev", "displayName": "Azure Developer CLI", "description": "Makes it easy to run, provision, and deploy Azure applications using the Azure Developer CLI", - "version": "0.5.0-alpha.1", + "version": "0.4.2", "license": "MIT", "icon": "resources/icon.png", "preview": true, diff --git a/ext/vscode/src/commands/loginCli.ts b/ext/vscode/src/commands/loginCli.ts index f223766a4b4..20b14eaacf6 100644 --- a/ext/vscode/src/commands/loginCli.ts +++ b/ext/vscode/src/commands/loginCli.ts @@ -2,12 +2,19 @@ // Licensed under the MIT License. import { IActionContext } from '@microsoft/vscode-azext-utils'; -import { createAzureDevCli } from '../utils/azureDevCli'; +import { TelemetryId } from '../telemetry/telemetryId'; +import { createAzureDevCli, onAzdLoginAttempted } from '../utils/azureDevCli'; import { executeAsTask } from '../utils/executeAsTask'; import { getAzDevTerminalTitle } from './cmdUtil'; export async function loginCli(context: IActionContext, shouldPrompt: boolean = true): Promise { const azureCli = await createAzureDevCli(context); const command = azureCli.commandBuilder.withArg('login'); - await executeAsTask(command.build(), getAzDevTerminalTitle(), { alwaysRunNew: true, focus: true }); + await executeAsTask(command.build(), getAzDevTerminalTitle(), { + focus: true, + alwaysRunNew: true, + env: azureCli.env + }, TelemetryId.LoginCli).then(() => { + onAzdLoginAttempted(); + }); } diff --git a/ext/vscode/src/telemetry/telemetryId.ts b/ext/vscode/src/telemetry/telemetryId.ts index 1c6ae182972..71ee0e10b73 100644 --- a/ext/vscode/src/telemetry/telemetryId.ts +++ b/ext/vscode/src/telemetry/telemetryId.ts @@ -28,6 +28,9 @@ export enum TelemetryId { // Extra data captured: whether the "purge" option was used. InfraDeleteCli = 'azure-dev.commands.cli.infra-delete.task', + // Reported when 'login' CLI command is invoked. + LoginCli = 'azure-dev.commands.cli.login-cli.task', + // Reported when 'pipeline config' CLI command is invoked. PipelineConfigCli = 'azure-dev.commands.cli.pipeline-config.task', diff --git a/ext/vscode/src/utils/azureDevCli.ts b/ext/vscode/src/utils/azureDevCli.ts index 062407ab01a..c287bc4b192 100644 --- a/ext/vscode/src/utils/azureDevCli.ts +++ b/ext/vscode/src/utils/azureDevCli.ts @@ -78,7 +78,12 @@ export function scheduleAzdYamlCheck(): void { export function onAzdInstallAttempted(): void { azdInstallAttempted = true; - // Clear the install state so we'll check again at the next command + // Clear the install+login state so we'll check again at the next command + azdLoginChecker.clear(); +} + +export function onAzdLoginAttempted(): void { + // Clear the install+login state so we'll check again at the next command azdLoginChecker.clear(); }