Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Cosmetic API calls #16868

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function main() {
tl.setResult(tl.TaskResult.Failed, error);
}
finally {
if(deploymentProvider != null && isDeploymentSuccess == false) {
if(deploymentProvider != null) {
await deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess);
}
Endpoint.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import tl = require('azure-pipelines-task-lib/task');
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common-v4/packageUtility';
import path = require('path');
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common-v4/ParameterParserUtility';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
This conversation was marked as resolved.
Show resolved Hide resolved

var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common-v4/utility.js');
var deployUtility = require('azure-pipelines-tasks-webdeployment-common-v4/utility.js');
Expand Down Expand Up @@ -60,10 +61,12 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen
tl.debug("Compressed folder into zip " + archivedWebPackage);
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(archivedWebPackage, this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });

break;
case PackageType.zip:
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(this.taskParams.Package.getPath(), this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });

break;

case PackageType.jar:
Expand All @@ -74,13 +77,15 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen
tl.debug("Initiated deployment via kudu service for webapp jar package : "+ webPackage);
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(webPackage, this.taskParams.TakeAppOfflineFlag,
{ slotName: this.appService.getSlot() });

break;

case PackageType.war:
tl.debug("Initiated deployment via kudu service for webapp war package : "+ this.taskParams.Package.getPath());
var warName = webCommonUtility.getFileNameFromPath(this.taskParams.Package.getPath(), ".war");
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingWarDeploy(this.taskParams.Package.getPath(),
{ slotName: this.appService.getSlot() }, warName);

break;

default:
Expand All @@ -94,8 +99,17 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
if(this.kuduServiceUtility) {
This conversation was marked as resolved.
Show resolved Hide resolved
await super.UpdateDeploymentStatus(isDeploymentSuccess);
if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {

this.activeDeploymentID = this.kuduServiceUtility.getDeploymentID();
if(isDeploymentSuccess == false){
This conversation was marked as resolved.
Show resolved Hide resolved
await super.UpdateDeploymentStatus(isDeploymentSuccess);
}
else if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {
await addReleaseAnnotation(this.azureEndpoint, this.appService, isDeploymentSuccess);
let appServiceApplicationUrl: string = await this.appServiceUtility.getApplicationURL(!this.taskParams.isLinuxApp
? this.taskParams.VirtualApplication : null);
console.log(tl.loc('AppServiceApplicationURL', appServiceApplicationUrl));
This conversation was marked as resolved.
Show resolved Hide resolved
tl.setVariable('AppServiceApplicationUrl', appServiceApplicationUrl);
await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProv
}

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
if(this.taskParams.ScriptType && this.kuduServiceUtility) {
if(this.taskParams.ScriptType && this.kuduServiceUtility && isDeploymentSuccess == false) {

await super.UpdateDeploymentStatus(isDeploymentSuccess);
This conversation was marked as resolved.
Show resolved Hide resolved
}
else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
This conversation was marked as resolved.
Show resolved Hide resolved
import tl = require('azure-pipelines-task-lib/task');
var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common-v4/utility.js');

Expand All @@ -19,14 +20,24 @@ export class WindowsWebAppWarDeployProvider extends AzureRmWebAppDeploymentProvi

this.zipDeploymentID = await this.kuduServiceUtility.deployUsingWarDeploy(this.taskParams.Package.getPath(),
{ slotName: this.appService.getSlot() }, warName);

await this.PostDeploymentStep();
}

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
if(this.kuduServiceUtility) {
await super.UpdateDeploymentStatus(isDeploymentSuccess);
if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {
this.activeDeploymentID = this.kuduServiceUtility.getDeploymentID();

if(isDeploymentSuccess == false){
await super.UpdateDeploymentStatus(isDeploymentSuccess);
}
else if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {

await addReleaseAnnotation(this.azureEndpoint, this.appService, isDeploymentSuccess);
let appServiceApplicationUrl: string = await this.appServiceUtility.getApplicationURL(!this.taskParams.isLinuxApp
? this.taskParams.VirtualApplication : null);
console.log(tl.loc('AppServiceApplicationURL', appServiceApplicationUrl));
tl.setVariable('AppServiceApplicationUrl', appServiceApplicationUrl);
await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import tl = require('azure-pipelines-task-lib/task');
import { FileTransformsUtility } from '../operations/FileTransformsUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common-v4/ParameterParserUtility';
import { DeploymentType } from '../operations/TaskParameters';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
This conversation was marked as resolved.
Show resolved Hide resolved
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common-v4/packageUtility';
const removeRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_PACKAGE -WEBSITE_RUN_FROM_ZIP';
var deployUtility = require('azure-pipelines-tasks-webdeployment-common-v4/utility.js');
Expand Down Expand Up @@ -54,10 +55,20 @@ export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvi

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
if(this.kuduServiceUtility) {
await super.UpdateDeploymentStatus(isDeploymentSuccess);
if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {
await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID);
this.activeDeploymentID = this.kuduServiceUtility.getDeploymentID();
if(isDeploymentSuccess == false){
await super.UpdateDeploymentStatus(isDeploymentSuccess);
}
else if(this.zipDeploymentID && this.activeDeploymentID && isDeploymentSuccess) {

await addReleaseAnnotation(this.azureEndpoint, this.appService, isDeploymentSuccess);
let appServiceApplicationUrl: string = await this.appServiceUtility.getApplicationURL(!this.taskParams.isLinuxApp
? this.taskParams.VirtualApplication : null);
console.log(tl.loc('AppServiceApplicationURL', appServiceApplicationUrl));
tl.setVariable('AppServiceApplicationUrl', appServiceApplicationUrl);
await this.kuduServiceUtility.postZipDeployOperation(this.zipDeploymentID, this.activeDeploymentID);
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class KuduServiceUtility {
public async updateDeploymentStatus(taskResult: boolean, DeploymentID: string, customMessage: any): Promise<string> {
try {
let requestBody = this._getUpdateHistoryRequest(taskResult, DeploymentID, customMessage);

return await this._appServiceKuduService.updateDeployment(requestBody);
}
catch(error) {
Expand Down Expand Up @@ -124,6 +123,7 @@ export class KuduServiceUtility {

var buildOrReleaseUrl = "" ;
var deploymentID: string = (releaseId ? releaseId : buildId) + Date.now().toString();

return deploymentID;
}

Expand Down Expand Up @@ -203,6 +203,7 @@ export class KuduServiceUtility {
var deploymentMessage = this._getUpdateHistoryRequest(true, null, customMessage).message;
queryParameters.push('message=' + encodeURIComponent(deploymentMessage));
await this._appServiceKuduService.zipDeploy(packagePath, queryParameters);

console.log(tl.loc('PackageDeploymentSuccess'));
console.log("NOTE: Run From Package makes wwwroot read-only, so you will receive an error when writing files to this directory.");

Expand All @@ -226,6 +227,7 @@ export class KuduServiceUtility {
}

var deploymentMessage = this._getUpdateHistoryRequest(true, null, customMessage).message;

queryParameters.push('message=' + encodeURIComponent(deploymentMessage));
let deploymentDetails = await this._appServiceKuduService.warDeploy(packagePath, queryParameters);
await this._processDeploymentResponse(deploymentDetails);
Expand Down Expand Up @@ -488,7 +490,7 @@ export class KuduServiceUtility {
}

deploymentID = !!deploymentID ? deploymentID : this.getDeploymentID();

var message = {
type : "deployment",
commitId : commitId,
Expand All @@ -503,9 +505,10 @@ export class KuduServiceUtility {
buildProjectUrl: buildProject ? collectionUrl + buildProject : "",
repositoryUrl: repositoryUrl,
branch: branch,
deploymentID: deploymentID,
teamProjectName: tl.getVariable("system.teamproject")
};

if(!!customMessage) {
// Append Custom Messages to original message
for(var attribute in customMessage) {
Expand Down
4 changes: 2 additions & 2 deletions Tasks/AzureRmWebAppDeploymentV4/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 4,
"Minor": 208,
"Patch": 1
"Minor": 211,
"Patch": 0
},
"releaseNotes": "What's new in version 4.*<br />Supports Zip Deploy, Run From Package, War Deploy [Details here](https://aka.ms/appServiceDeploymentMethods)<br />Supports App Service Environments<br />Improved UI for discovering different App service types supported by the task<br/>Run From Package is the preferred deployment method, which makes files in wwwroot folder read-only<br/>Click [here](https://aka.ms/azurermwebdeployreadme) for more information.",
"minimumAgentVersion": "2.104.1",
Expand Down
6 changes: 3 additions & 3 deletions Tasks/AzureRmWebAppDeploymentV4/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 4,
"Minor": 208,
"Patch": 1
"Minor": 211,
"Patch": 0
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.104.1",
Expand Down Expand Up @@ -653,4 +653,4 @@
"FailedToUpdateApplicationInsightsResource": "ms-resource:loc.messages.FailedToUpdateApplicationInsightsResource",
"RunFromZipPreventsFileInUseError": "ms-resource:loc.messages.RunFromZipPreventsFileInUseError"
}
}
}