add git and ssd for build agent

This commit is contained in:
Freddy Kristiansen 2020-07-02 06:53:04 +02:00
Родитель 7abe57d14d
Коммит 67985ee205
9 изменённых файлов: 55 добавлений и 19 удалений

Просмотреть файл

@ -11,10 +11,10 @@ Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.We
choco feature enable -n allowGlobalConfirmation
AddToStatus "Install git"
choco install git --force
choco install git --force --params "/NoAutoCrlf"
AddToStatus "Install Edge Insider"
choco install microsoft-edge-insider
AddToStatus "Install Edge"
choco install microsoft-edge
AddToStatus "Install Chrome"
choco install googlechrome

Просмотреть файл

@ -0,0 +1,20 @@
if (!(Test-Path function:AddToStatus)) {
function AddToStatus([string]$line, [string]$color = "Gray") {
("<font color=""$color"">" + [DateTime]::Now.ToString([System.Globalization.DateTimeFormatInfo]::CurrentInfo.ShortTimePattern.replace(":mm",":mm:ss")) + " $line</font>") | Add-Content -Path "c:\demo\status.txt" -Force -ErrorAction SilentlyContinue
Write-Host -ForegroundColor $color $line
}
}
#Install Choco
AddToSTatus "Install Choco"
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n allowGlobalConfirmation
AddToStatus "Install git"
choco install git --force --params "/NoAutoCrlf"
AddToStatus "Install Edge"
choco install microsoft-edge
AddToStatus "VSCode"
choco install vscode

Просмотреть файл

@ -49,7 +49,7 @@
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D4_v3",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v2",
"Standard_D3_v2",

Просмотреть файл

@ -33,7 +33,7 @@
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D4_v3",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v2",
"Standard_D3_v2",
@ -56,6 +56,17 @@
"Description": "Select the VM size of the deployment"
}
},
"StorageAccountType": {
"type": "string",
"defaultValue": "Premium_LRS",
"allowedValues": [
"Standard_LRS",
"Premium_LRS"
],
"metadata": {
"Description": "Select the preferred storage account type. Standard_LRS is HDD, Premium_LRS is SSD."
}
},
"vmAdminUsername": {
"type": "string",
"defaultValue": "vmadmin",
@ -102,7 +113,7 @@
},
"FinalSetupScriptUrl": {
"type": "string",
"defaultValue": "",
"defaultValue": "additional-installforbuildgent.ps1",
"metadata": {
"Description": "Optional: Specify a Url to a PowerShell script that should be executed on the VM to do the final setup of the VM."
}
@ -118,8 +129,8 @@
"imagePublisher": "[if(equals(variables('OperatingSystem'),'Windows 10'),'MicrosoftWindowsDesktop','MicrosoftWindowsServer')]",
"imageOffer": "[if(equals(variables('OperatingSystem'),'Windows 10'),'Windows-10','WindowsServer')]",
"imageSku": "[if(equals(variables('OperatingSystem'),'Windows 10'),'rs5-pro',if(equals(variables('OperatingSystem'),'Windows Server 2016'),'2016-Datacenter',if(equals(variables('OperatingSystem'),'Windows Server 2019'),'2019-Datacenter','2019-Datacenter-with-containers')))]",
"storageAccountType": "Standard_LRS",
"vmStorageAccountContainerName": "vhds",
"storageAccountType": "[parameters('StorageAccountType')]",
"OSDiskName": "[concat(variables('vmName'),'_osdisk')]",
"publicIPAddressName": "[concat(variables('vmName'), '_pip')]",
"storageAccountName": "[concat('storage', uniqueString(resourceGroup().id))]",
"networkSecurityGroupName": "networksecuritygroup",
@ -287,7 +298,7 @@
}
},
{
"apiVersion": "2015-06-15",
"apiVersion": "2018-10-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('server1Name')]",
"location": "[resourceGroup().location]",
@ -315,12 +326,14 @@
"version": "latest"
},
"osDisk": {
"name": "osdisk",
"vhd": {
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('server1Name'),'.vhd')]"
},
"createOption": "FromImage",
"osType": "Windows",
"name": "[variables('OSDiskName')]",
"caching": "ReadWrite",
"createOption": "FromImage"
"managedDisk": {
"storageAccountType": "[variables('storageAccountType')]"
},
"diskSizeGB": 128
}
},
"networkProfile": {

Просмотреть файл

@ -57,7 +57,7 @@
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D4_v3",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v2",
"Standard_D3_v2",

Просмотреть файл

@ -58,7 +58,7 @@
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D4_v3",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v2",
"Standard_D3_v2",
@ -413,7 +413,6 @@
"imageSku": "[if(equals(variables('OperatingSystem'),'Windows 10'),'19h2-pro',if(equals(variables('OperatingSystem'),'Windows Server 2016'),'2016-Datacenter',if(equals(variables('OperatingSystem'),'Windows Server 2019'),'2019-Datacenter','2019-Datacenter-with-containers')))]",
"storageAccountType": "[parameters('StorageAccountType')]",
"OSDiskName": "[concat(variables('vmName'),'_osdisk')]",
"vmStorageAccountContainerName": "vhds",
"publicIPAddressName": "[concat(variables('vmName'), '_pip')]",
"storageAccountName": "[concat('storage', uniqueString(resourceGroup().id))]",
"storagequeueAccountName": "[concat('queue', uniqueString(resourceGroup().id))]",

Просмотреть файл

@ -49,7 +49,7 @@
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D4_v3",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v2",
"Standard_D3_v2",

Просмотреть файл

@ -57,7 +57,7 @@
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_D4_v3",
"defaultValue": "Standard_D4s_v3",
"allowedValues": [
"Standard_D2_v2",
"Standard_D3_v2",

Просмотреть файл

@ -65,6 +65,10 @@ if ($installDocker) {
}
if ($finalSetupScriptUrl) {
if ($finalSetupScriptUrl -notlike "https://*" -and $finalSetupScriptUrl -notlike "http://*") {
$finalSetupScriptUrl = $templateLink.Substring(0,$templateLink.LastIndexOf('/')+1)+$finalSetupScriptUrl
}
Set-Content -Path (Join-Path $DownloadFolder "url.txt") -Value "$finalSetupScriptUrl"
$finalSetupScript = Join-Path $DownloadFolder "FinalSetupScript.ps1"
Download-File -sourceUrl $finalSetupScriptUrl -destinationFile $finalSetupScript
. $finalSetupScript