Skip to content

Azure App Service | Sidecar | Only Containers Scenario #21231

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"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\"",
"loc.input.label.configurationStrings": "Configuration settings",
"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",
"loc.input.label.sitecontainersConfig": "Site Containers Config",
"loc.input.help.sitecontainersConfig": "Provide sitecontainers-config JSON for SiteContainers deployments.",
"loc.messages.Invalidwebapppackageorfolderpathprovided": "Invalid App Service package or folder path provided: %s",
"loc.messages.GotconnectiondetailsforazureRMWebApp0": "Got service connection details for Azure App Service:'%s'",
"loc.messages.ErrorNoSuchDeployingMethodExists": "Error : No such deploying method exists",
Expand Down Expand Up @@ -181,5 +183,8 @@
"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.",
"loc.messages.SingleContainerDeployment": "Single-container Deployment to the webapp '%s' as only the image detail was specified.",
"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",
"loc.messages.MultiContainerDeploymentWithoutTransformation": "Multi-container deployment to the webapp '%s' without transformation of Docker-Compose file because only Docker-Compose file was specified."
"loc.messages.MultiContainerDeploymentWithoutTransformation": "Multi-container deployment to the webapp '%s' without transformation of Docker-Compose file because only Docker-Compose file was specified.",
"loc.messages.StartedUpdatingSiteContainers": "Started updating site containers.",
"loc.messages.UpdatingSiteContainer": "Updating site container: %s",
"loc.messages.CompletedUpdatingSiteContainers": "Completed updating site containers."
}
12 changes: 10 additions & 2 deletions Tasks/AzureWebAppContainerV1/azurermwebappdeploymentprovider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azure-arm-rest/azu
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility';
import { AzureAppServiceUtilityExt } from './operations/AzureAppServiceUtilityExt';
import { ContainerBasedDeploymentUtility } from './operations/ContainerBasedDeploymentUtility';
import { SiteContainersDeploymentUtility } from './operations/SiteContainersDeploymentUtility';
import { KuduServiceUtility } from './operations/KuduServiceUtility';
import { addReleaseAnnotation } from './operations/ReleaseAnnotationUtility';
import { TaskParameters } from './taskparameters';
Expand Down Expand Up @@ -45,8 +46,15 @@ export class AzureRmWebAppDeploymentProvider{
this.taskParams["StartupCommand"] = null;
}

let containerDeploymentUtility: ContainerBasedDeploymentUtility = new ContainerBasedDeploymentUtility(this.appService);
await containerDeploymentUtility.deployWebAppImage(this.taskParams);
if (this.taskParams.SiteContainers && this.taskParams.SiteContainers.length > 0) {
tl.debug("Updating site containers.");
let siteContainersDeploymentUtility: SiteContainersDeploymentUtility = new SiteContainersDeploymentUtility(this.appService);
await siteContainersDeploymentUtility.updateSiteContainers(this.taskParams.SiteContainers);
} else {
let containerDeploymentUtility: ContainerBasedDeploymentUtility = new ContainerBasedDeploymentUtility(this.appService);
await containerDeploymentUtility.deployWebAppImage(this.taskParams);
}

await this.appServiceUtilityExt.updateScmTypeAndConfigurationDetails();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import tl = require('azure-pipelines-task-lib/task');
import { AzureAppService } from "azure-pipelines-tasks-azure-arm-rest/azure-arm-app-service";
import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azure-arm-rest/azureAppServiceUtility';
import { SiteContainer } from 'azure-pipelines-tasks-azure-arm-rest/SiteContainer';

export class SiteContainersDeploymentUtility {
private _appService: AzureAppService;
private _appServiceUtility: AzureAppServiceUtility;

constructor(appService: AzureAppService) {
this._appService = appService;
this._appServiceUtility = new AzureAppServiceUtility(appService);
}

public async updateSiteContainers(siteContainers: Array<SiteContainer>): Promise<void> {

console.log(tl.loc('StartedUpdatingSiteContainers'));

for (const siteContainer of siteContainers) {
console.log(tl.loc('UpdatingSiteContainer', siteContainer.getName()));
await this._appServiceUtility.updateSiteContainer(siteContainer);
}

console.log(tl.loc('CompletedUpdatingSiteContainers'));
}
}
Loading