diff --git a/Tasks/AzureWebAppV1/deploymentProvider/AzureRmWebAppDeploymentProvider.ts b/Tasks/AzureWebAppV1/deploymentProvider/AzureRmWebAppDeploymentProvider.ts index 288338a5e3d6..640dc2ca028a 100644 --- a/Tasks/AzureWebAppV1/deploymentProvider/AzureRmWebAppDeploymentProvider.ts +++ b/Tasks/AzureWebAppV1/deploymentProvider/AzureRmWebAppDeploymentProvider.ts @@ -1,17 +1,20 @@ -import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider'; -import { TaskParameters } from '../taskparameters'; -import { KuduServiceUtility } from 'azurermdeploycommon/operations/KuduServiceUtility'; +import * as ParameterParser from 'azurermdeploycommon/operations/ParameterParserUtility' + import { AzureAppService } from 'azurermdeploycommon/azure-arm-rest/azure-arm-app-service'; -import { Kudu } from 'azurermdeploycommon/azure-arm-rest/azure-arm-app-service-kudu'; import { AzureAppServiceUtility } from 'azurermdeploycommon/operations/AzureAppServiceUtility'; -import tl = require('azure-pipelines-task-lib/task'); -import * as ParameterParser from 'azurermdeploycommon/operations/ParameterParserUtility' -import { addReleaseAnnotation } from 'azurermdeploycommon/operations/ReleaseAnnotationUtility'; -import { PackageUtility } from 'azurermdeploycommon/webdeployment-common/packageUtility'; import { AzureDeployPackageArtifactAlias } from 'azurermdeploycommon/Constants'; +import { AzureEndpoint } from 'azurermdeploycommon/azure-arm-rest/azureModels'; import { AzureRmEndpointAuthenticationScheme } from 'azurermdeploycommon/azure-arm-rest/constants'; +import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider'; +import { Kudu } from 'azurermdeploycommon/azure-arm-rest/azure-arm-app-service-kudu'; +import { KuduServiceUtility } from 'azurermdeploycommon/operations/KuduServiceUtility'; +import { PackageUtility } from 'azurermdeploycommon/webdeployment-common/packageUtility'; +import { TaskParameters } from '../taskparameters'; +import { addReleaseAnnotation } from 'azurermdeploycommon/operations/ReleaseAnnotationUtility'; + +import tl = require('azure-pipelines-task-lib/task'); + import publishProfileUtility = require("utility-common-v2/publishProfileUtility"); -import { AzureEndpoint } from 'azurermdeploycommon/azure-arm-rest/azureModels'; export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvider { protected taskParams:TaskParameters; @@ -22,8 +25,7 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide protected virtualApplicationPath: string = ""; protected activeDeploymentID; protected publishProfileScmCredentials: publishProfileUtility.ScmCredentials; - protected isPublishProfileAuthSchemeEndpoint: boolean = false; - protected slotName: string; + protected slotName; constructor(taskParams: TaskParameters) { this.taskParams = taskParams; @@ -34,7 +36,6 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide public async PreDeploymentStep() { if (this.taskParams.azureEndpoint.scheme && this.taskParams.azureEndpoint.scheme.toLowerCase() === AzureRmEndpointAuthenticationScheme.PublishProfile) { let publishProfileEndpoint: AzureEndpoint = this.taskParams.azureEndpoint; - this.isPublishProfileAuthSchemeEndpoint = true; this.publishProfileScmCredentials = await publishProfileUtility.getSCMCredentialsFromPublishProfile(publishProfileEndpoint.PublishProfile); this.kuduService = new Kudu(this.publishProfileScmCredentials.scmUri, this.publishProfileScmCredentials.username, this.publishProfileScmCredentials.password); let resourceId = publishProfileEndpoint.resourceId; @@ -53,16 +54,17 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide public async DeployWebAppStep() {} public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) { - if(this.kuduServiceUtility) { - if (!this.isPublishProfileAuthSchemeEndpoint) { - await addReleaseAnnotation(this.taskParams.azureEndpoint, this.appService, isDeploymentSuccess); - } + if(!!this.appService) { + await addReleaseAnnotation(this.taskParams.azureEndpoint, this.appService, isDeploymentSuccess); + } + + if(!!this.kuduServiceUtility) { this.activeDeploymentID = await this.kuduServiceUtility.updateDeploymentStatus(isDeploymentSuccess, null, {'type': 'Deployment', slotName: this.slotName}); tl.debug('Active DeploymentId :'+ this.activeDeploymentID); } let appServiceApplicationUrl: string; - if (!this.isPublishProfileAuthSchemeEndpoint) { + if (!!this.appServiceUtility) { appServiceApplicationUrl = await this.appServiceUtility.getApplicationURL(); } else { appServiceApplicationUrl = this.publishProfileScmCredentials.applicationUrl; @@ -72,7 +74,7 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide } protected async PostDeploymentStep() { - if (!this.isPublishProfileAuthSchemeEndpoint) { + if (!!this.appServiceUtility) { if(this.taskParams.AppSettings) { var customApplicationSettings = ParameterParser.parse(this.taskParams.AppSettings); await this.appServiceUtility.updateAndMonitorAppSettings(customApplicationSettings); diff --git a/Tasks/AzureWebAppV1/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts b/Tasks/AzureWebAppV1/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts index d2ab3a2ef0eb..6541633c9a15 100644 --- a/Tasks/AzureWebAppV1/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts +++ b/Tasks/AzureWebAppV1/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts @@ -1,8 +1,10 @@ -import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; -import tl = require('azure-pipelines-task-lib/task'); import * as ParameterParser from 'azurermdeploycommon/operations/ParameterParserUtility' + +import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; import { PackageType } from 'azurermdeploycommon/webdeployment-common/packageUtility'; +import tl = require('azure-pipelines-task-lib/task'); + var webCommonUtility = require('azurermdeploycommon/webdeployment-common/utility.js'); var deployUtility = require('azurermdeploycommon/webdeployment-common/utility.js'); var zipUtility = require('azurermdeploycommon/webdeployment-common/ziputility.js'); @@ -60,12 +62,11 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen } public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) { + await super.UpdateDeploymentStatus(isDeploymentSuccess); if(this.kuduServiceUtility) { if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) { await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID); - } - - await super.UpdateDeploymentStatus(isDeploymentSuccess); + } } } } \ No newline at end of file diff --git a/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppRunFromZipProvider.ts b/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppRunFromZipProvider.ts index 14acf6a457a9..db09e9fa0bc6 100644 --- a/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppRunFromZipProvider.ts +++ b/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppRunFromZipProvider.ts @@ -1,10 +1,13 @@ -import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; -import tl = require('azure-pipelines-task-lib/task'); import * as ParameterParser from 'azurermdeploycommon/operations/ParameterParserUtility' + +import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; import { DeploymentType } from '../taskparameters'; +import { FileTransformsUtility } from 'azurermdeploycommon/operations/FileTransformsUtility.js'; import { PackageType } from 'azurermdeploycommon/webdeployment-common/packageUtility'; import { addReleaseAnnotation } from 'azurermdeploycommon/operations/ReleaseAnnotationUtility'; -import { FileTransformsUtility } from 'azurermdeploycommon/operations/FileTransformsUtility.js'; + +import tl = require('azure-pipelines-task-lib/task'); + var deployUtility = require('azurermdeploycommon/webdeployment-common/utility.js'); var zipUtility = require('azurermdeploycommon/webdeployment-common/ziputility.js'); @@ -36,7 +39,7 @@ export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProv } tl.debug("Initiated deployment via kudu service for webapp package : " + webPackage); - if (!this.isPublishProfileAuthSchemeEndpoint) { + if (!!this.appServiceUtility) { var addCustomApplicationSetting = ParameterParser.parse(runFromZipAppSetting); var deleteCustomApplicationSetting = ParameterParser.parse(oldRunFromZipAppSetting); var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(addCustomApplicationSetting, deleteCustomApplicationSetting); @@ -55,14 +58,17 @@ export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProv } public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) { - if (this.isPublishProfileAuthSchemeEndpoint) { - await super.UpdateDeploymentStatus(isDeploymentSuccess); - } else { + if(!!this.appService) { await addReleaseAnnotation(this.taskParams.azureEndpoint, this.appService, isDeploymentSuccess); + } - let appServiceApplicationUrl: string = await this.appServiceUtility.getApplicationURL(); - console.log(tl.loc('AppServiceApplicationURL', appServiceApplicationUrl)); - tl.setVariable('AppServiceApplicationUrl', appServiceApplicationUrl); + let appServiceApplicationUrl: string; + if (!!this.appServiceUtility) { + appServiceApplicationUrl = await this.appServiceUtility.getApplicationURL(); + } else { + appServiceApplicationUrl = this.publishProfileScmCredentials.applicationUrl; } + console.log(tl.loc('AppServiceApplicationURL', appServiceApplicationUrl)); + tl.setVariable('AppServiceApplicationUrl', appServiceApplicationUrl); } } \ No newline at end of file diff --git a/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppWarDeployProvider.ts b/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppWarDeployProvider.ts index 6fb6792eaa7d..1bdac545a83c 100644 --- a/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppWarDeployProvider.ts +++ b/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppWarDeployProvider.ts @@ -1,8 +1,8 @@ import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; + import tl = require('azure-pipelines-task-lib/task'); var webCommonUtility = require('azurermdeploycommon/webdeployment-common/utility.js'); - export class WindowsWebAppWarDeployProvider extends AzureRmWebAppDeploymentProvider { private zipDeploymentID: string; @@ -25,8 +25,8 @@ export class WindowsWebAppWarDeployProvider extends AzureRmWebAppDeploymentProvi } public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) { + await super.UpdateDeploymentStatus(isDeploymentSuccess); if(this.kuduServiceUtility) { - await super.UpdateDeploymentStatus(isDeploymentSuccess); if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) { await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID); } diff --git a/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppZipDeployProvider.ts b/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppZipDeployProvider.ts index c45dfe545b3c..ab0069cff286 100644 --- a/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppZipDeployProvider.ts +++ b/Tasks/AzureWebAppV1/deploymentProvider/WindowsWebAppZipDeployProvider.ts @@ -1,9 +1,12 @@ -import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; -import tl = require('azure-pipelines-task-lib/task'); import * as ParameterParser from 'azurermdeploycommon/operations/ParameterParserUtility' + +import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider'; import { DeploymentType } from '../taskparameters'; -import { PackageType } from 'azurermdeploycommon/webdeployment-common/packageUtility'; import { FileTransformsUtility } from 'azurermdeploycommon/operations/FileTransformsUtility.js'; +import { PackageType } from 'azurermdeploycommon/webdeployment-common/packageUtility'; + +import tl = require('azure-pipelines-task-lib/task'); + const removeRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_PACKAGE -WEBSITE_RUN_FROM_ZIP'; var deployUtility = require('azurermdeploycommon/webdeployment-common/utility.js'); var zipUtility = require('azurermdeploycommon/webdeployment-common/ziputility.js'); @@ -35,9 +38,9 @@ export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvi } tl.debug("Initiated deployment via kudu service for webapp package : "); - if (!this.isPublishProfileAuthSchemeEndpoint) { + if (!!this.appServiceUtility) { var deleteApplicationSetting = ParameterParser.parse(removeRunFromZipAppSetting) - var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(null, deleteApplicationSetting); + var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(null, deleteApplicationSetting); if(!isNewValueUpdated) { await this.kuduServiceUtility.warmpUp(); @@ -52,8 +55,8 @@ export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvi } public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) { + await super.UpdateDeploymentStatus(isDeploymentSuccess); if(this.kuduServiceUtility) { - await super.UpdateDeploymentStatus(isDeploymentSuccess); if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) { await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID); } diff --git a/Tasks/AzureWebAppV1/task.json b/Tasks/AzureWebAppV1/task.json index b6c025a5dd0a..05ea9b377c6b 100644 --- a/Tasks/AzureWebAppV1/task.json +++ b/Tasks/AzureWebAppV1/task.json @@ -18,7 +18,7 @@ "version": { "Major": 1, "Minor": 160, - "Patch": 1 + "Patch": 2 }, "minimumAgentVersion": "2.104.1", "groups": [ diff --git a/Tasks/AzureWebAppV1/task.loc.json b/Tasks/AzureWebAppV1/task.loc.json index ece609131793..684dc88a5a31 100644 --- a/Tasks/AzureWebAppV1/task.loc.json +++ b/Tasks/AzureWebAppV1/task.loc.json @@ -18,7 +18,7 @@ "version": { "Major": 1, "Minor": 160, - "Patch": 1 + "Patch": 2 }, "minimumAgentVersion": "2.104.1", "groups": [