Skip to content

Commit 1484c0c

Browse files
authored
Azure App Service | Sidecar | Only Containers Scenario (#21264)
* add changes for sitecontainers * add changes for sitecontainers * Added changes for sitecontainers * Change patch versio * make changes for testing * update package.json for AzureWebAppContainer1 * updating logs * update after final testing * address nit comments
1 parent bb56b93 commit 1484c0c

File tree

8 files changed

+1103
-252
lines changed

8 files changed

+1103
-252
lines changed

Tasks/AzureWebAppContainerV1/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"loc.input.help.appSettings": "Edit web app application settings following the syntax -key value . Value containing spaces should be enclosed in double quotes.<br /> <b>Example</b> : -Port 5000 -RequestTimeout 5000 <br /> -WEBSITE_TIME_ZONE \"Eastern Standard Time\"",
2525
"loc.input.label.configurationStrings": "Configuration settings",
2626
"loc.input.help.configurationStrings": "Edit web app configuration settings following the syntax -key value. Value containing spaces should be enclosed in double quotes.<br /> Example : -phpVersion 5.6 -linuxFxVersion: node|6.11",
27+
"loc.input.label.siteContainersConfig": "Site Containers Config",
28+
"loc.input.help.siteContainersConfig": "Provide siteContainers-config JSON for SiteContainers deployments.",
2729
"loc.messages.Invalidwebapppackageorfolderpathprovided": "Invalid App Service package or folder path provided: %s",
2830
"loc.messages.GotconnectiondetailsforazureRMWebApp0": "Got service connection details for Azure App Service:'%s'",
2931
"loc.messages.ErrorNoSuchDeployingMethodExists": "Error : No such deploying method exists",
@@ -181,5 +183,8 @@
181183
"loc.messages.FailedToDeployToWebApp": "Deployment to the webapp '%s' failed. For single-container, just specify a valid image name. For multi-container specifying a Docker-Compose file is mandatory and specifying image names is optional. Provided images names if the tags in Docker-Compose file need to be substituted.",
182184
"loc.messages.SingleContainerDeployment": "Single-container Deployment to the webapp '%s' as only the image detail was specified.",
183185
"loc.messages.MultiContainerDeploymentWithTransformation": "Multi-container deployment to the webapp '%s' with the transformation of Docker-Compose file as both image name and Docker-Compose file were specified",
184-
"loc.messages.MultiContainerDeploymentWithoutTransformation": "Multi-container deployment to the webapp '%s' without transformation of Docker-Compose file because only Docker-Compose file was specified."
186+
"loc.messages.MultiContainerDeploymentWithoutTransformation": "Multi-container deployment to the webapp '%s' without transformation of Docker-Compose file because only Docker-Compose file was specified.",
187+
"loc.messages.StartedUpdatingSiteContainers": "Started updating Site Containers.",
188+
"loc.messages.UpdatingSiteContainer": "Updating SiteContainer: %s",
189+
"loc.messages.CompletedUpdatingSiteContainers": "Completed updating Site Containers."
185190
}

Tasks/AzureWebAppContainerV1/azurermwebappdeploymentprovider.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azure-arm-rest/azu
55
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility';
66
import { AzureAppServiceUtilityExt } from './operations/AzureAppServiceUtilityExt';
77
import { ContainerBasedDeploymentUtility } from './operations/ContainerBasedDeploymentUtility';
8+
import { SiteContainersDeploymentUtility } from './operations/SiteContainersDeploymentUtility';
89
import { KuduServiceUtility } from './operations/KuduServiceUtility';
910
import { addReleaseAnnotation } from './operations/ReleaseAnnotationUtility';
1011
import { TaskParameters } from './taskparameters';
@@ -45,8 +46,15 @@ export class AzureRmWebAppDeploymentProvider{
4546
this.taskParams["StartupCommand"] = null;
4647
}
4748

48-
let containerDeploymentUtility: ContainerBasedDeploymentUtility = new ContainerBasedDeploymentUtility(this.appService);
49-
await containerDeploymentUtility.deployWebAppImage(this.taskParams);
49+
if (this.taskParams.SiteContainers && this.taskParams.SiteContainers.length > 0) {
50+
tl.debug("Updating site containers.");
51+
let siteContainersDeploymentUtility: SiteContainersDeploymentUtility = new SiteContainersDeploymentUtility(this.appService);
52+
await siteContainersDeploymentUtility.updateSiteContainers(this.taskParams.SiteContainers);
53+
} else {
54+
let containerDeploymentUtility: ContainerBasedDeploymentUtility = new ContainerBasedDeploymentUtility(this.appService);
55+
await containerDeploymentUtility.deployWebAppImage(this.taskParams);
56+
}
57+
5058
await this.appServiceUtilityExt.updateScmTypeAndConfigurationDetails();
5159
}
5260

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import tl = require('azure-pipelines-task-lib/task');
2+
import { AzureAppService } from "azure-pipelines-tasks-azure-arm-rest/azure-arm-app-service";
3+
import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azure-arm-rest/azureAppServiceUtility';
4+
import { SiteContainer } from 'azure-pipelines-tasks-azure-arm-rest/SiteContainer';
5+
6+
export class SiteContainersDeploymentUtility {
7+
private _appService: AzureAppService;
8+
private _appServiceUtility: AzureAppServiceUtility;
9+
10+
constructor(appService: AzureAppService) {
11+
this._appService = appService;
12+
this._appServiceUtility = new AzureAppServiceUtility(appService);
13+
}
14+
15+
public async updateSiteContainers(siteContainers: SiteContainer[]): Promise<void> {
16+
17+
console.log(tl.loc('StartedUpdatingSiteContainers'));
18+
19+
for (const siteContainer of siteContainers) {
20+
console.log(tl.loc('UpdatingSiteContainer', siteContainer.getName()));
21+
await this._appServiceUtility.updateSiteContainer(siteContainer);
22+
}
23+
24+
console.log(tl.loc('CompletedUpdatingSiteContainers'));
25+
}
26+
}

0 commit comments

Comments
 (0)