Skip to content

Commit

Permalink
Azure App Service Manage for Slot
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent1173 authored Dec 22, 2016
1 parent 350372b commit 52e5ac1
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"loc.input.help.Action": "Action to be performed on the App Service. You can Start/Stop/Restart an App Service or Manage a slot swap.",
"loc.input.label.WebAppName": "App Service name",
"loc.input.help.WebAppName": "Enter or select the name of an existing Azure App Service",
"loc.input.label.SpecifySlot": "Specify Slot",
"loc.input.label.ResourceGroupName": "Resource group",
"loc.input.help.ResourceGroupName": "Enter or Select the Azure Resource Group that contains the Azure App Service specified above",
"loc.input.label.SourceSlot": "Source Slot",
Expand All @@ -19,6 +20,7 @@
"loc.input.help.TargetSlot": "The swap action directs destination slot's traffic to the source slot",
"loc.input.label.PreserveVnet": "Preserve Vnet",
"loc.input.help.PreserveVnet": "Preserve the Virtual network settings",
"loc.input.label.Slot": "Slot",
"loc.messages.ErrorNoSuchDeployingMethodExists": "Error : Deploy method MSDeploy does not exists for Azure Web App: %s",
"loc.messages.Successfullyupdatedslotswaphistory": "Successfully updated slot swap history at %s for Azure Web App : %s",
"loc.messages.Failedtoupdateslotswaphistory": "Failed to update slot swap history for Azure Web App : %s",
Expand Down
12 changes: 7 additions & 5 deletions Tasks/AzureAppServiceManage/azureappservicemanage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ async function run() {
var action = tl.getInput('Action', true);
var webAppName: string = tl.getInput('WebAppName', true);
var resourceGroupName: string = tl.getInput('ResourceGroupName', false);
var specifySlotFlag: boolean = tl.getBoolInput('SpecifySlot', false);
var slotName: string = tl.getInput('Slot', false);
var sourceSlot: string = tl.getInput('SourceSlot', false);
var swapWithProduction = tl.getBoolInput('SwapWithProduction', false);
var targetSlot: string = tl.getInput('TargetSlot', false);
Expand All @@ -51,15 +53,15 @@ async function run() {
}
switch(action) {
case "Start Azure App Service": {
tl._writeLine(await azureRmUtil.startAppService(endPoint, resourceGroupName, webAppName));
tl._writeLine(await azureRmUtil.startAppService(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName));
break;
}
case "Stop Azure App Service": {
tl._writeLine(await azureRmUtil.stopAppService(endPoint, resourceGroupName, webAppName));
tl._writeLine(await azureRmUtil.stopAppService(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName));
break;
}
case "Restart Azure App Service": {
tl._writeLine(await azureRmUtil.restartAppService(endPoint, resourceGroupName, webAppName));
tl._writeLine(await azureRmUtil.restartAppService(endPoint, resourceGroupName, webAppName, specifySlotFlag, slotName));
break;
}
case "Swap Slots": {
Expand Down Expand Up @@ -89,8 +91,8 @@ async function run() {
await updateKuduDeploymentLog(endPoint, webAppName, resourceGroupName, !(swapWithProduction), targetSlot, taskResult, customMessage, deploymentId);
}
else {
customMessage['slotName'] = 'Production';
await updateKuduDeploymentLog(endPoint, webAppName, resourceGroupName, false, null, taskResult, customMessage, deploymentId);
customMessage['slotName'] = (specifySlotFlag) ? slotName : 'Production';
await updateKuduDeploymentLog(endPoint, webAppName, resourceGroupName, specifySlotFlag, slotName, taskResult, customMessage, deploymentId);
}
}

Expand Down
103 changes: 0 additions & 103 deletions Tasks/AzureAppServiceManage/kududeploymentlog.ts

This file was deleted.

23 changes: 20 additions & 3 deletions Tasks/AzureAppServiceManage/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
},
"minimumAgentVersion": "1.102.0",
"instanceNameFormat": "$(Action): $(WebAppName)",
"groups": [

"groups": [
],
"inputs": [
{
Expand Down Expand Up @@ -55,6 +54,13 @@
},
"helpMarkDown": "Enter or select the name of an existing Azure App Service"
},
{
"name": "SpecifySlot",
"type": "boolean",
"label": "Specify Slot",
"required": false,
"visibleRule": "Action != Swap Slots"
},
{
"name": "ResourceGroupName",
"type": "pickList",
Expand All @@ -65,7 +71,7 @@
"EditableOptions": "True"
},
"helpMarkDown": "Enter or Select the Azure Resource Group that contains the Azure App Service specified above",
"visibleRule":"Action = Swap Slots"
"visibleRule": "Action = Swap Slots || SpecifySlot = true"
},
{
"name": "SourceSlot",
Expand Down Expand Up @@ -108,6 +114,17 @@
"required": false,
"helpMarkDown": "Preserve the Virtual network settings",
"visibleRule": "Action = Swap Slots"
},
{
"name": "Slot",
"type": "pickList",
"label": "Slot",
"defaultValue": "",
"properties": {
"EditableOptions": "True"
},
"required": true,
"visibleRule": "Action != Swap Slots && SpecifySlot = true"
}
],
"dataSourceBindings": [
Expand Down
20 changes: 19 additions & 1 deletion Tasks/AzureAppServiceManage/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
},
"helpMarkDown": "ms-resource:loc.input.help.WebAppName"
},
{
"name": "SpecifySlot",
"type": "boolean",
"label": "ms-resource:loc.input.label.SpecifySlot",
"required": false,
"visibleRule": "Action != Swap Slots"
},
{
"name": "ResourceGroupName",
"type": "pickList",
Expand All @@ -63,7 +70,7 @@
"EditableOptions": "True"
},
"helpMarkDown": "ms-resource:loc.input.help.ResourceGroupName",
"visibleRule": "Action = Swap Slots"
"visibleRule": "Action = Swap Slots || SpecifySlot = true"
},
{
"name": "SourceSlot",
Expand Down Expand Up @@ -106,6 +113,17 @@
"required": false,
"helpMarkDown": "ms-resource:loc.input.help.PreserveVnet",
"visibleRule": "Action = Swap Slots"
},
{
"name": "Slot",
"type": "pickList",
"label": "ms-resource:loc.input.label.Slot",
"defaultValue": "",
"properties": {
"EditableOptions": "True"
},
"required": true,
"visibleRule": "Action != Swap Slots && SpecifySlot = true"
}
],
"dataSourceBindings": [
Expand Down
Loading

0 comments on commit 52e5ac1

Please sign in to comment.