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

Azure web app - support multicontainer #9943

Merged
merged 15 commits into from
Apr 12, 2019

Conversation

20shivangi
Copy link
Contributor

No description provided.

@vincent1173 vincent1173 changed the title Users/shmittal/multiple containers Azure web app - support multicontainer Mar 29, 2019
@vincent1173 vincent1173 added Area: Release Area: AzureAppService Label to monitor Azure App Service issues labels Mar 29, 2019
@@ -95,12 +95,20 @@
},
{
"name": "imageName",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please syncup with @azooinmyluggage or @RoopeshNair for updating the help strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azooinmyluggage , Can you please provide help strings for this too? The help text should convey to provide the image name for single container and "replaceable images" for multi-containers.
Should we add an alias as "images" for multi-container?

"label": "Image name",
"defaultValue": "",
"required": true,
"helpMarkDown": "A globally unique top-level domain name for your specific registry or namespace.<br/> Note: Fully qualified image name will be of the format: '<b>`<registry or namespace`></b>/`<repository`>:`<tag`>'. For example, '<b>myregistry.azurecr.io</b>/nginx:latest'."
},
{
"name": "configFilePath",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm the name with PMs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename it to multicontainerConfigFile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multicontainerConfigFile is inline with the az cli parameter

az webapp config container set –resource-group [resource group] –name [app name] –multicontainer-config-type “compose” –multicontainer-config-file

Tasks/AzureWebAppContainerV1/taskparameters.ts Outdated Show resolved Hide resolved
Tasks/AzureWebAppContainerV1/taskparameters.ts Outdated Show resolved Hide resolved
@@ -36,6 +39,18 @@ export class TaskParametersUtility {
var endpointTelemetry = '{"endpointId":"' + taskParameters.connectedServiceName + '"}';
console.log("##vso[telemetry.publish area=TaskEndpointId;feature=AzureRmWebAppDeployment]" + endpointTelemetry);

taskParameters.isMultiContainer = false;
taskParameters.isMultiContainer = taskParameters.ImageName && taskParameters.ImageName.indexOf("\n") !=-1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is a valid file provided in config file, then also it is multicontainer app

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something we should discuss with PMs. Because then imageName input can be optional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be optional. In KubernetesManifest task as well, the containers input is optional. One needs to provide a value for this input only if they want to perform tag/sha256 substitutions for the images specified in the docker compose file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had in mandatory in our task since for single container scenarios it is required. Making it optional will allow the user to execute the task with invalid inputs though we will catch it at run time.

return newFilePath;
}

private getTempDirectory(): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this function to azure-pipelines-tasks/Tasks/Common/AzureRmDeploy-common/webdeployment-common/utility.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is done.

return tl.getVariable('agent.tempDirectory') || os.tmpdir();
}

private tokenizeImages(currentString: string, imageName: string, imageNameWithNewTag: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change current string to content

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

tl.debug("Updating the webapp configuration.");
await this._updateConfigurationDetails(properties["ConfigurationSettings"], properties["StartupCommand"], imageName, isLinuxApp);
await this._updateConfigurationDetails(properties["ConfigurationSettings"], properties["StartupCommand"], imageName, isLinuxApp, isMultiContainer, configFilePath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you be using updatedFilePath here? I couldnt find where you updated original file content.
It seems this will deploy provided config file content without transformation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

@@ -50,6 +50,10 @@ export function mockTaskArgument(): ma.TaskLibAnswers{
},
"webAppPkg": {
"isDirectory": true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have changes in this file? Does this PR contain L0s as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it was made to fix some L0,
Existing L0 is sufficient here.

@vincent1173 vincent1173 self-requested a review April 2, 2019 10:26
@@ -17,6 +17,8 @@
"loc.input.help.slotName": "Enter or Select an existing Slot other than the Production slot.",
"loc.input.label.imageName": "Image name",
"loc.input.help.imageName": "A globally unique top-level domain name for your specific registry or namespace.<br/> Note: Fully qualified image name will be of the format: '<b>`<registry or namespace`></b>/`<repository`>:`<tag`>'. For example, '<b>myregistry.azurecr.io</b>/nginx:latest'.",
"loc.input.label.configFilePath": "Configuration File",
"loc.input.help.configFilePath": "Path of the configuration. Should be fully qualified path or relative to the default working directory.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path of the Docker-Compose file. Should be a fully qualified path or relative to the default working directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

@@ -175,5 +177,10 @@
"loc.messages.RestartedAppService": "App Service '%s' restarted successfully.",
"loc.messages.RestartedAppServiceSlot": "App Service '%s-%s' restarted successfully.",
"loc.messages.FailedToRestartAppService": "Failed to restart App Service '%s'. Error: %s",
"loc.messages.FailedToRestartAppServiceSlot": "Failed to restart App Service '%s-%s'. Error: %s"
"loc.messages.FailedToRestartAppServiceSlot": "Failed to restart App Service '%s-%s'. Error: %s",
"loc.messages.FailedToGetConfigurationFile": "Failed to get configuration file for multi containers. Please enter the valid configuration file path.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to locate the Docker-Compose file which is required for deploying multi-container apps. Please enter a valid Docker-Compose file path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

"label": "Image name",
"defaultValue": "",
"required": true,
"helpMarkDown": "A globally unique top-level domain name for your specific registry or namespace.<br/> Note: Fully qualified image name will be of the format: '<b>`<registry or namespace`></b>/`<repository`>:`<tag`>'. For example, '<b>myregistry.azurecr.io</b>/nginx:latest'."
},
{
"name": "configFilePath",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename it to multicontainerConfigFile

"label": "Image name",
"defaultValue": "",
"required": true,
"helpMarkDown": "A globally unique top-level domain name for your specific registry or namespace.<br/> Note: Fully qualified image name will be of the format: '<b>`<registry or namespace`></b>/`<repository`>:`<tag`>'. For example, '<b>myregistry.azurecr.io</b>/nginx:latest'."
},
{
"name": "configFilePath",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multicontainerConfigFile is inline with the az cli parameter

az webapp config container set –resource-group [resource group] –name [app name] –multicontainer-config-type “compose” –multicontainer-config-file

"label": "Configuration File",
"defaultValue": "",
"required": false,
"helpMarkDown": "Path of the configuration. Should be fully qualified path or relative to the default working directory."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path of the Docker-Compose file. Should be a fully qualified path or relative to the default working directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

"loc.messages.FailedToRestartAppServiceSlot": "Failed to restart App Service '%s-%s'. Error: %s"
"loc.messages.FailedToRestartAppServiceSlot": "Failed to restart App Service '%s-%s'. Error: %s",
"loc.messages.FailedToGetConfigurationFile": "Failed to get configuration file for multi containers. Please enter the valid configuration file path.",
"loc.messages.FailedToDeployToWebApp": "No deployment can happen to the webapp '%s'. For single-container, provide a valid image name and for multi-container, config file is mandatory and image names can also be provided if you want tags to be substituted.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

"loc.messages.FailedToRestartAppServiceSlot": "Failed to restart App Service '%s-%s'. Error: %s",
"loc.messages.FailedToGetConfigurationFile": "Failed to get configuration file for multi containers. Please enter the valid configuration file path.",
"loc.messages.FailedToDeployToWebApp": "No deployment can happen to the webapp '%s'. For single-container, provide a valid image name and for multi-container, config file is mandatory and image names can also be provided if you want tags to be substituted.",
"loc.messages.SingleContainerDeployment": "Single Container Deployment to the webapp '%s' because only image name is given",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single-container Deployment to the webapp '%s' as only the image detail was sepcified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

"loc.messages.FailedToGetConfigurationFile": "Failed to get configuration file for multi containers. Please enter the valid configuration file path.",
"loc.messages.FailedToDeployToWebApp": "No deployment can happen to the webapp '%s'. For single-container, provide a valid image name and for multi-container, config file is mandatory and image names can also be provided if you want tags to be substituted.",
"loc.messages.SingleContainerDeployment": "Single Container Deployment to the webapp '%s' because only image name is given",
"loc.messages.MultiContainerDeploymentWithTransformation": "Multi Container Deployment to the webapp '%s' with transformation of configuration file because both image name and configuration file are given",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Multi-container deployment to the webapp '%s' with the transformation of Docker-Compose file as both image name and Docker-Compose file was specified"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

"loc.messages.FailedToDeployToWebApp": "No deployment can happen to the webapp '%s'. For single-container, provide a valid image name and for multi-container, config file is mandatory and image names can also be provided if you want tags to be substituted.",
"loc.messages.SingleContainerDeployment": "Single Container Deployment to the webapp '%s' because only image name is given",
"loc.messages.MultiContainerDeploymentWithTransformation": "Multi Container Deployment to the webapp '%s' with transformation of configuration file because both image name and configuration file are given",
"loc.messages.MultiContainerDeploymentWithoutTransformation": "Multi Container Deployment to the webapp '%s' without transformation of configuration file because only configuration file is given"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Multi-container deployment to the webapp '%s' without transformation of Docker-Compose file because only Docker-Compose file was specified."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done.

let updatedConfigFilePath: string = configFilePath;

if(imageName) {
tl.debug("Deploying image " + imageName + " to the webapp " + this._appService.getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statment is correct for single container deployment but for multi-container mention config file name instead.

Copy link
Contributor

@SumiranAgg SumiranAgg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix one comment I recently provided before merging

@20shivangi 20shivangi merged commit 815f926 into master Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: AzureAppService Label to monitor Azure App Service issues Area: Release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants