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

1933760-set the parameter value customMessage:true in updateDeploymen… #16141

Merged
merged 3 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 5 additions & 4 deletions Tasks/AzureRmWebAppDeploymentV4/azurermwebappdeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ async function main() {
var taskParams: TaskParameters = TaskParametersUtility.getParameters();
var deploymentFactory: DeploymentFactory = new DeploymentFactory(taskParams);
var deploymentProvider = await deploymentFactory.GetDeploymentProvider();

tl.debug("Predeployment Step Started");
await deploymentProvider.PreDeploymentStep();

tl.debug("Deployment Step Started");

await deploymentProvider.DeployWebAppStep();

}
catch(error) {
tl.debug("Deployment Failed with Error: " + error);
isDeploymentSuccess = false;
tl.setResult(tl.TaskResult.Failed, error);
}
finally {
if(deploymentProvider != null) {
if(deploymentProvider != null && isDeploymentSuccess == false) {
await deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess);
}

Endpoint.dispose();
tl.debug(isDeploymentSuccess ? "Deployment Succeded" : "Deployment failed");

Expand Down
29 changes: 19 additions & 10 deletions Tasks/AzureRmWebAppDeploymentV4/operations/KuduServiceUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ 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 All @@ -48,7 +49,7 @@ export class KuduServiceUtility {
let vstsPostDeploymentFolderPath: string = path.join(physicalRootPath.substring(1), '..', 'VSTS_PostDeployment_' + uniqueID);
try {
var rootDirectoryPath = directoryPath || physicalRootPath.substring(1);

if(taskParams.TakeAppOfflineFlag) {
await this._appOfflineKuduService(rootDirectoryPath, true);
}
Expand Down Expand Up @@ -160,7 +161,7 @@ export class KuduServiceUtility {
public async deployUsingZipDeploy(packagePath: string, appOffline?: boolean, customMessage?: any): Promise<string> {
try {
console.log(tl.loc('PackageDeploymentInitiated'));

if(appOffline) {
await this._appOfflineKuduService(physicalRootPath, true);
tl.debug('Wait for 5 seconds for app_offline to take effect');
Expand All @@ -171,13 +172,17 @@ export class KuduServiceUtility {
'isAsync=true',
'deployer=' + VSTS_ZIP_DEPLOY
];

var deploymentMessage = this._getUpdateHistoryRequest(true, null, customMessage).message;
queryParameters.push('message=' + encodeURIComponent(deploymentMessage));

let deploymentDetails = await this._appServiceKuduService.zipDeploy(packagePath, queryParameters);

await this._processDeploymentResponse(deploymentDetails);
if(appOffline) {
await this._appOfflineKuduService(physicalRootPath, false);
}

console.log(tl.loc('PackageDeploymentSuccess'));
return deploymentDetails.id;
}
Expand All @@ -190,16 +195,17 @@ export class KuduServiceUtility {
public async deployUsingRunFromZip(packagePath: string, customMessage?: any) : Promise<void> {
try {
console.log(tl.loc('PackageDeploymentInitiated'));

let queryParameters: Array<string> = [
'deployer=' + VSTS_DEPLOY
];

var deploymentMessage = this._getUpdateHistoryRequest(null, null, customMessage).message;
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.");

}
catch(error) {
tl.error(tl.loc('PackageDeploymentFailed'));
Expand All @@ -218,13 +224,13 @@ export class KuduServiceUtility {
if(targetFolderName) {
queryParameters.push('name=' + encodeURIComponent(targetFolderName));
}

var deploymentMessage = this._getUpdateHistoryRequest(null, null, customMessage).message;
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);
console.log(tl.loc('PackageDeploymentSuccess'));

return deploymentDetails.id;
}
catch(error) {
Expand All @@ -251,9 +257,11 @@ export class KuduServiceUtility {

public async warmpUp() {
try {

tl.debug('warming up Kudu Service');
await this._appServiceKuduService.getAppSettings();
tl.debug('warmed up Kudu Service');

}
catch(error) {
tl.debug('Failed to warm-up Kudu: ' + error.toString());
Expand Down Expand Up @@ -289,6 +297,7 @@ export class KuduServiceUtility {
var deploymentLogs = await this._appServiceKuduService.getDeploymentLogs(log_url);
for(var deploymentLog of deploymentLogs) {
console.log(`${deploymentLog.message}`);

if(deploymentLog.details_url) {
await this._printZipDeployLogs(deploymentLog.details_url);
}
Expand Down Expand Up @@ -443,7 +452,7 @@ export class KuduServiceUtility {
// Task is running in release determine build information of selected artifact using artifactAlias
author = tl.getVariable('release.requestedfor') || tl.getVariable('agent.name');
tl.debug(`Artifact Source Alias is: ${artifactAlias}`);

commitId = tl.getVariable(`release.artifacts.${artifactAlias}.sourceVersion`);
repoProvider = tl.getVariable(`release.artifacts.${artifactAlias}.repository.provider`);
repoName = tl.getVariable(`release.artifacts.${artifactAlias}.repository.name`);
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": 198,
"Patch": 0
"Minor": 205,
"Patch": 13
},
"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
4 changes: 2 additions & 2 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": 198,
"Patch": 0
"Minor": 205,
"Patch": 13
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.104.1",
Expand Down