44 *--------------------------------------------------------------------------------------------*/
55
66import { type Site , type SiteConfigResource , type StringDictionary } from '@azure/arm-appservice' ;
7- import { getDeployFsPath , getDeployNode , deploy as innerDeploy , showDeployConfirmation , type IDeployContext , type IDeployPaths } from '@microsoft/vscode-azext-azureappservice' ;
7+ import { getDeployFsPath , getDeployNode , deploy as innerDeploy , showDeployConfirmation , type IDeployContext , type IDeployPaths , type ParsedSite } from '@microsoft/vscode-azext-azureappservice' ;
88import { DialogResponses , type ExecuteActivityContext , type IActionContext , type ISubscriptionActionContext } from '@microsoft/vscode-azext-utils' ;
99import { type AzureSubscription } from '@microsoft/vscode-azureresources-api' ;
1010import type * as vscode from 'vscode' ;
@@ -83,6 +83,8 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
8383 return await getOrCreateFunctionApp ( context )
8484 } ) ;
8585
86+ const site = await node . resolved . getSite ( context ) ;
87+
8688 if ( node . contextValue . includes ( 'container' ) ) {
8789 const learnMoreLink : string = 'https://aka.ms/deployContainerApps'
8890 await context . ui . showWarningMessage ( localize ( 'containerFunctionAppError' , 'Deploy is not currently supported for containerized function apps within the Azure Functions extension. Please read here to learn how to deploy your project.' ) , { learnMoreLink } ) ;
@@ -98,19 +100,19 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
98100 context . telemetry . properties . projectRuntime = version ;
99101 context . telemetry . properties . languageModel = String ( languageModel ) ;
100102
101- if ( language === ProjectLanguage . Python && ! node . site . isLinux ) {
103+ if ( language === ProjectLanguage . Python && ! site . isLinux ) {
102104 context . errorHandling . suppressReportIssue = true ;
103105 throw new Error ( localize ( 'pythonNotAvailableOnWindows' , 'Python projects are not supported on Windows Function Apps. Deploy to a Linux Function App instead.' ) ) ;
104106 }
105107
106- void showCoreToolsWarning ( context , version , node . site . fullName ) ;
108+ void showCoreToolsWarning ( context , version , site . fullName ) ;
107109
108- const client = await node . site . createClient ( actionContext ) ;
110+ const client = await site . createClient ( actionContext ) ;
109111 const siteConfig : SiteConfigResource = await client . getSiteConfig ( ) ;
110112 const isConsumption : boolean = await client . getIsConsumption ( actionContext ) ;
111113 let isZipDeploy : boolean = siteConfig . scmType !== ScmType . LocalGit && siteConfig . scmType !== ScmType . GitHub ;
112- if ( ! isZipDeploy && node . site . isLinux && isConsumption ) {
113- ext . outputChannel . appendLog ( localize ( 'linuxConsZipOnly' , 'WARNING: Using zip deploy because scm type "{0}" is not supported on Linux consumption' , siteConfig . scmType ) , { resourceName : node . site . fullName } ) ;
114+ if ( ! isZipDeploy && site . isLinux && isConsumption ) {
115+ ext . outputChannel . appendLog ( localize ( 'linuxConsZipOnly' , 'WARNING: Using zip deploy because scm type "{0}" is not supported on Linux consumption' , siteConfig . scmType ) , { resourceName : site . fullName } ) ;
114116 isZipDeploy = true ;
115117 context . deployMethod = 'zip' ;
116118 }
@@ -121,10 +123,10 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
121123 const doRemoteBuild : boolean | undefined = getWorkspaceSetting < boolean > ( remoteBuildSetting , deployPaths . effectiveDeployFsPath ) && ! isFlexConsumption ;
122124 actionContext . telemetry . properties . scmDoBuildDuringDeployment = String ( doRemoteBuild ) ;
123125 if ( doRemoteBuild ) {
124- await validateRemoteBuild ( context , node . site , context . workspaceFolder , language ) ;
126+ await validateRemoteBuild ( context , site , context . workspaceFolder , language ) ;
125127 }
126128
127- if ( isZipDeploy && node . site . isLinux && isConsumption && ! doRemoteBuild ) {
129+ if ( isZipDeploy && site . isLinux && isConsumption && ! doRemoteBuild ) {
128130 context . deployMethod = 'storage' ;
129131 } else if ( isFlexConsumption ) {
130132 context . deployMethod = 'flexconsumption' ;
@@ -161,7 +163,7 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
161163 } as unknown as ISubscriptionActionContext ;
162164
163165 const eolWarningMessage = await getEolWarningMessages ( subContext , {
164- site : node . site . rawSite ,
166+ site : site . rawSite ,
165167 isLinux : client . isLinux ,
166168 isFlex : isFlexConsumption ,
167169 client
@@ -175,7 +177,7 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
175177 deploymentWarningMessages . length > 0 ) {
176178 // if there is a warning message, we want to show the deploy confirmation regardless of the setting
177179 const deployCommandId = 'azureFunctions.deploy' ;
178- await showDeployConfirmation ( context , node . site , deployCommandId , deploymentWarningMessages ,
180+ await showDeployConfirmation ( context , site , deployCommandId , deploymentWarningMessages ,
179181 eolWarningMessage ? stackUpgradeLearnMoreLink : undefined ) ;
180182 }
181183
@@ -185,8 +187,8 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
185187 void validateGlobSettings ( context , context . effectiveDeployFsPath ) ;
186188 }
187189
188- if ( language === ProjectLanguage . CSharp && ! node . site . isLinux || durableStorageType ) {
189- await updateWorkerProcessTo64BitIfRequired ( context , siteConfig , node , language , durableStorageType ) ;
190+ if ( language === ProjectLanguage . CSharp && ! site . isLinux || durableStorageType ) {
191+ await updateWorkerProcessTo64BitIfRequired ( context , siteConfig , site , language , durableStorageType ) ;
190192 }
191193
192194 // app settings shouldn't be checked with flex consumption plans
@@ -222,15 +224,15 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
222224 }
223225 const deployContext = Object . assign ( context , await createActivityContext ( ) ) ;
224226 deployContext . activityChildren = [ ] ;
225- await innerDeploy ( node . site , deployFsPath , deployContext ) ;
227+ await innerDeploy ( site , deployFsPath , deployContext ) ;
226228 }
227229 ) ;
228230
229231 await notifyDeployComplete ( context , node , context . workspaceFolder , isFlexConsumption ) ;
230232}
231233
232- async function updateWorkerProcessTo64BitIfRequired ( context : IDeployContext , siteConfig : SiteConfigResource , node : SlotTreeItem , language : ProjectLanguage , durableStorageType : DurableBackendValues | undefined ) : Promise < void > {
233- const client = await node . site . createClient ( context ) ;
234+ async function updateWorkerProcessTo64BitIfRequired ( context : IDeployContext , siteConfig : SiteConfigResource , site : ParsedSite , language : ProjectLanguage , durableStorageType : DurableBackendValues | undefined ) : Promise < void > {
235+ const client = await site . createClient ( context ) ;
234236 const config : SiteConfigResource = {
235237 use32BitWorkerProcess : false
236238 } ;
0 commit comments