azure-vm-agents-plugin/src/main/resources/customImageTemplateWithScript.json

170 lines
7.3 KiB
JSON
Raw Normal View History

Azure RM model updates * Make the resource group configurable * Update SDK to 0.9.4 * Fix: Token expiration was incorrectly calculated (API is named a bit oddly). * Fix: Token expiration is in seconds. * Change VM/deployment names to ones that are valid * Fix location + VM sizes It appears that that the location and VM size APIs do not currently support the AAD based authentication. The certificate is required. Rather than re-introduce the cert for just this limited UI scenario, I have decided to hard-code the list based on the returned info from current Azure. This is a decent short term solution, since a move to the 1.0.0 API (when released) will require that this code be changed anyway and presumably this problem should be fixed for good at that point. * Proper handling for custom image URIs * Asynchronous verification of the subscription info * Asynchronous verification of the azure templates * Asynchronous provisioning * Clean up resources after unsuccessful provisioning * Lots of logging updates * Fix: SSH launcher - Get channels before connection for exec channels Getting the channels after connection introduces a race where we could potentially fail to read from the input streams if they were obtained from the channel after the connection had completed. * Add diagnostics to image verification messages * Asynchronous deletion via UI * Update version of Jsch * Temporarily disable image verification for reference images * Allow for initialization scripts to be run as root * Cleanup of slaves now works properly * Doesn't clean up when node is taken offline by user * Post build tasks won't kill other runs or show errors in the job logging * Retention strategy now for online nodes, cleanup for offline nodes * Nodes that are marked to shut down on idle can now be restarted properly (before too many could be started) * Add option to treat failures of the initialization script as a reason to discard the VM (linux only currently) * Reenable Windows custom script extension for startup * Update documentation with new sample startup scripts Add setAcceptingTasks appropriately doc fixup
2016-09-12 23:20:16 +00:00
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountKey" : {
"type" : "secureString"
}
},
"variables": {
"virtualNetworkName": "jenkinsarm-vnet",
"subnetName": "jenkinsarm-snet",
"storageAccountName": "jenkinsarmst",
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
"addressPrefix": "10.0.0.0/16",
"subnetPrefix": "10.0.0.0/24",
"publicIPAddressType": "Dynamic",
"storageAccountContainerName": "vhds",
"storageAccountType": "Standard_LRS",
"startupScriptURI": "",
"startupScriptName": "",
"jenkinsServerURL": "",
"clientSecrets": []
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[variables('storageAccountName')]",
"apiVersion": "2015-05-01-preview",
"location": "[variables('location')]",
"properties": {
"accountType": "[variables('storageAccountType')]"
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('virtualNetworkName')]",
"location": "[variables('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[concat(variables('vmName'), copyIndex(), 'IPName')]",
"location": "[variables('location')]",
"copy": {
"name": "vmcopy",
"count": "[parameters('count')]"
},
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[concat(variables('vmName'), copyIndex())]"
}
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(variables('vmName'), copyIndex(), 'NIC')]",
"location": "[variables('location')]",
"copy": {
"name": "vmcopy",
"count": "[parameters('count')]"
},
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('vmName'), copyIndex(), 'IPName')]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('vmName'), copyIndex(), 'IPName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}]
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(variables('vmName'), copyIndex())]",
"location": "[variables('location')]",
"copy": {
"name": "vmcopy",
"count": "[parameters('count')]"
},
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('vmName'), copyIndex(), 'NIC')]"
],
"properties": {
"hardwareProfile": {
"vmSize": "[variables('vmSize')]"
},
"osProfile": {
"computername": "[concat(variables('vmName'), copyIndex())]",
"adminUsername": "[variables('adminUsername')]",
"adminPassword": "[variables('adminPassword')]"
},
"storageProfile": {
"osDisk": {
"name": "[concat(variables('vmName'), copyIndex())]",
"osType": "[variables('osType')]",
"caching": "ReadWrite",
"image": {
"uri": "[variables('image')]"
},
"createOption": "FromImage",
"vhd": {
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('storageAccountContainerName'),'/', variables('vmName'), copyIndex(), 'OSDisk.vhd')]"
}
}
},
"networkProfile": {
"networkInterfaces": [{
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('vmName'), copyIndex(), 'NIC'))]"
}]
}
},
"resources" : [
{
"type": "extensions",
"name": "[concat('customScript', variables('vmName'), copyIndex())]",
"apiVersion": "2015-05-01-preview",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'), copyIndex())]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[variables('startupScriptURI')]"
],
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File ', variables('startupScriptName'),' ', variables('jenkinsServerURL'),' ', variables('vmName'),copyIndex(),' ', variables('clientSecrets')[copyIndex()])]"
},
"protectedSettings": {
"storageAccountName" : "[variables('storageAccountName')]",
"storageAccountKey" : "[parameters('storageAccountKey')]"
}
}
}
]
}
]
}