Skip to content

Commit

Permalink
Merge branch 'main' into bmw/1es
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft committed Feb 2, 2024
2 parents 14ee213 + f43e74b commit 55520b1
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 48 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": true
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
"editor.detectIndentation": false,
"editor.formatOnSave": true,
Expand Down
18 changes: 9 additions & 9 deletions appservice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions appservice/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@microsoft/vscode-azext-azureappservice",
"author": "Microsoft Corporation",
"version": "2.3.4",
"version": "2.3.6",
"description": "Common tools for developing Azure App Service extensions for VS Code",
"tags": [
"azure",
Expand Down Expand Up @@ -40,7 +40,7 @@
"@azure/core-client": "^1.7.2",
"@azure/core-rest-pipeline": "^1.10.3",
"@azure/storage-blob": "^12.3.0",
"@microsoft/vscode-azext-azureutils": "^2.0.6",
"@microsoft/vscode-azext-azureutils": "2.0.2",
"@microsoft/vscode-azext-github": "^1.0.0",
"@microsoft/vscode-azext-utils": "^2.1.0",
"dayjs": "^1.11.2",
Expand Down
28 changes: 6 additions & 22 deletions appservice/src/SiteClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ export class SiteClient implements IAppSettingsClient {
}

public async zipPushDeploy(context: IActionContext, file: RequestBodyType, rawQueryParameters: KuduModels.PushDeploymentZipPushDeployOptionalParams): Promise<AzExtPipelineResponse> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const client: ServiceClient = await createGenericClient(context, this._site.subscription);
const queryParameters = convertQueryParamsValuesToString(rawQueryParameters);
const queryString = new URLSearchParams(queryParameters).toString();
const request = createPipelineRequest({
Expand All @@ -338,9 +336,7 @@ export class SiteClient implements IAppSettingsClient {
}

public async warPushDeploy(context: IActionContext, file: RequestBodyType, rawQueryParameters: KuduModels.PushDeploymentWarPushDeployOptionalParams): Promise<AzExtPipelineResponse> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const client: ServiceClient = await createGenericClient(context, this._site.subscription);
const queryParameters = convertQueryParamsValuesToString(rawQueryParameters);
const queryString = new URLSearchParams(queryParameters).toString();
const request = createPipelineRequest({
Expand All @@ -355,9 +351,7 @@ export class SiteClient implements IAppSettingsClient {
// TODO: only supporting /zip endpoint for now, but should support /zipurl as well
public async flexDeploy(context: IActionContext, file: RequestBodyType,
rawQueryParameters: { remoteBuild?: boolean, Deployer?: string }): Promise<AzExtPipelineResponse> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const client: ServiceClient = await createGenericClient(context, this._site.subscription);
const queryParameters = convertQueryParamsValuesToString(rawQueryParameters);
const queryString = new URLSearchParams(queryParameters).toString();
const request = createPipelineRequest({
Expand All @@ -370,9 +364,7 @@ export class SiteClient implements IAppSettingsClient {
}

public async deploy(context: IActionContext, id: string): Promise<AzExtPipelineResponse> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const client: ServiceClient = await createGenericClient(context, this._site.subscription);
return await client.sendRequest(createPipelineRequest({
method: 'PUT',
url: `${this._site.kuduUrl}/api/deployments/${id}`
Expand All @@ -383,7 +375,6 @@ export class SiteClient implements IAppSettingsClient {
public async getDeployResults(context: IActionContext): Promise<KuduModels.DeployResult[]> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
addStatusCodePolicy: true,
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const response: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({
method: 'GET',
Expand All @@ -403,7 +394,6 @@ export class SiteClient implements IAppSettingsClient {
public async getDeployResult(context: IActionContext, deployId: string): Promise<KuduModels.DeployResult> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
addStatusCodePolicy: true,
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const response: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({
method: 'GET',
Expand All @@ -416,7 +406,6 @@ export class SiteClient implements IAppSettingsClient {
public async getLogEntry(context: IActionContext, deployId: string): Promise<KuduModels.LogEntry[]> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
addStatusCodePolicy: true,
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const response: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({
method: 'GET',
Expand All @@ -437,7 +426,6 @@ export class SiteClient implements IAppSettingsClient {
public async getLogEntryDetails(context: IActionContext, deployId: string, logId: string): Promise<KuduModels.LogEntry[]> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
addStatusCodePolicy: true,
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const response: AzExtPipelineResponse = await client.sendRequest(createPipelineRequest({
method: 'GET',
Expand All @@ -454,19 +442,15 @@ export class SiteClient implements IAppSettingsClient {
}

public async vfsGetItem(context: IActionContext, url: string): Promise<AzExtPipelineResponse> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const client: ServiceClient = await createGenericClient(context, this._site.subscription);
return await client.sendRequest(createPipelineRequest({
method: 'GET',
url,
}));
}

public async vfsPutItem(context: IActionContext, data: string | ArrayBuffer, url: string, rawHeaders?: {}): Promise<AzExtPipelineResponse> {
const client: ServiceClient = await createGenericClient(context, this._site.subscription, {
endpoint: this._site.subscription.environment.managementEndpointUrl,
});
const client: ServiceClient = await createGenericClient(context, this._site.subscription);
const headers = createHttpHeaders(rawHeaders);
return await client.sendRequest(createPipelineRequest({
method: 'PUT',
Expand Down
2 changes: 1 addition & 1 deletion appservice/src/deploy/wizard/DeployExecuteStepBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function getLinuxFxVersionForTelemetry(config: SiteConfigResource): string {
}

async function setDeploymentTelemetry(context: InnerDeployContext, config: SiteConfigResource, aspPromise: Promise<AppServicePlan | undefined>): Promise<void> {
context.telemetry.properties.sourceHash = await randomUtils.getPseudononymousStringHash(context.workspaceFolder.uri.fsPath);
context.telemetry.properties.sourceHash = await randomUtils.getPseudononymousStringHash(context.fsPath);
context.telemetry.properties.destHash = await randomUtils.getPseudononymousStringHash(context.site.fullName);
context.telemetry.properties.scmType = String(config.scmType);
context.telemetry.properties.isSlot = context.site.isSlot ? 'true' : 'false';
Expand Down
2 changes: 1 addition & 1 deletion appservice/src/deploy/wizard/DeployLocalGitExecuteStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import { DeployExecuteStepBase } from "./DeployExecuteStepBase";

export class DeployLocalGitExecuteStep extends DeployExecuteStepBase {
public async deployCore(context: InnerDeployContext): Promise<void> {
await localGitDeploy(context.site, { fsPath: context.workspaceFolder.uri.fsPath }, context);
await localGitDeploy(context.site, { fsPath: context.fsPath }, context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export class PostDeploySyncTriggersExecuteStep extends AzureWizardExecuteStep<In
}
}

public shouldExecute(_context: InnerDeployContext): boolean {
return true;
public shouldExecute(context: InnerDeployContext): boolean {
// this gets set in `waitForDeploymentToComplete` for consumption plans or storage account deployments
return !!context.syncTriggersPostDeploy;
}
}
6 changes: 2 additions & 4 deletions appservice/src/deploy/wizard/createDeployWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function createDeployExecuteSteps(context: InnerDeployContext): Pro
executeSteps.push(new DeployWarExecuteStep());
} else if (javaRuntime && /^java/i.test(javaRuntime) && !context.site.isFunctionApp) {
const pathFileMap = new Map<string, string>([
[path.basename(context.workspaceFolder.uri.fsPath), 'app.jar']
[path.basename(context.fsPath), 'app.jar']
]);
executeSteps.push(new DeployZipPushExecuteStep(pathFileMap));
} else if (context.deployMethod === 'flexconsumption') {
Expand All @@ -55,9 +55,7 @@ export async function createDeployExecuteSteps(context: InnerDeployContext): Pro
}

executeSteps.push(new PostDeployTaskExecuteStep(config))
if (context.syncTriggersPostDeploy) {
executeSteps.push(new PostDeploySyncTriggersExecuteStep());
}
executeSteps.push(new PostDeploySyncTriggersExecuteStep());

return executeSteps;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DeployFlexExecuteStep extends DeployZipBaseExecuteStep {
};

return await runWithZipStream(context, {
fsPath: context.workspaceFolder.uri.fsPath,
fsPath: context.fsPath,
site: context.site,
pathFileMap: this.pathFileMap,
callback,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { DeployZipBaseExecuteStep } from "./DeployZipBaseExecuteStep";

export class DeployWarExecuteStep extends DeployZipBaseExecuteStep {
public async deployZip(context: InnerDeployContext): Promise<void> {
if (getFileExtension(context.workspaceFolder.uri.fsPath) !== 'war') {
if (getFileExtension(context.fsPath) !== 'war') {
throw new Error(l10n.t('Path specified is not a war file'));
}

const kuduClient = await context.site.createClient(context);
await kuduClient.warPushDeploy(context, () => fs.createReadStream(context.workspaceFolder.uri.fsPath), {
await kuduClient.warPushDeploy(context, () => fs.createReadStream(context.fsPath), {
isAsync: true,
author: publisherName,
deployer: publisherName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export abstract class DeployZipBaseExecuteStep extends DeployExecuteStepBase {
}

public async deployCore(context: InnerDeployContext): Promise<void> {
const fsPath = context.workspaceFolder.uri.fsPath;
const fsPath = context.fsPath;
if (!(await AzExtFsExtra.pathExists(fsPath))) {
throw new Error(l10n.t('Failed to deploy path that does not exist: {0}', fsPath));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class DeployZipPushExecuteStep extends DeployZipBaseExecuteStep {
};

return await runWithZipStream(context, {
fsPath: context.workspaceFolder.uri.fsPath,
fsPath: context.fsPath,
site: context.site,
pathFileMap: this.pathFileMap,
callback,
Expand Down

0 comments on commit 55520b1

Please sign in to comment.