Skip to content
This repository was archived by the owner on Feb 25, 2021. It is now read-only.

Updated to support Wave repo; added usability enhancements #26

Open
wants to merge 1 commit 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
17 changes: 16 additions & 1 deletion infra/AzureTestCellDeployment/Deploy-1Linux-TestCell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,22 @@ if (-not $res)
$TemplateFile = "1Linux_CellDeployment.json"
$TemplateFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateFile)

Select-AzureRmSubscription -SubscriptionID $SubscriptionId
$currentSubscription = (Get-AzureRmContext).Subscription
if ($currentSubscription.SubscriptionId -ne $SubscriptionId)
{
Write-Host "Setting current subscription"
Select-AzureRmSubscription -SubscriptionID $SubscriptionId
}

# validate location
$azureLocations = ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute).ResourceTypes | Where-Object ResourceTypeName -eq virtualMachines).Locations
if (-not $azureLocations.Contains($ResourceGroupLocation) )
{
Write-Host "Error: Invalid location specified. The location '" $ResourceGroupLocation "' does not exist or does not support VMs"
Write-Host "Valid locations are:"
$azureLocations
return
}

# Create or update the resource group using the specified template file and template parameters file
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop
Expand Down
17 changes: 16 additions & 1 deletion infra/AzureTestCellDeployment/Deploy-1Win-TestCell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,22 @@ if ($ResourceGroupName.Length -gt 10)
$TemplateFile = "1Windows_CellDeployment.json"
$TemplateFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateFile)

Select-AzureRmSubscription -SubscriptionID $SubscriptionId
$currentSubscription = (Get-AzureRmContext).Subscription
if ($currentSubscription.SubscriptionId -ne $SubscriptionId)
{
Write-Host "Setting current subscription"
Select-AzureRmSubscription -SubscriptionID $SubscriptionId
}

# validate location
$azureLocations = ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute).ResourceTypes | Where-Object ResourceTypeName -eq virtualMachines).Locations
if (-not $azureLocations.Contains($ResourceGroupLocation) )
{
Write-Host "Error: Invalid location specified. The location '" $ResourceGroupLocation "' does not exist or does not support VMs"
Write-Host "Valid locations are:"
$azureLocations
return
}

# Create or update the resource group using the specified template file and template parameters file
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function DoLinuxDeployment()

Write-Host "Doing linux config using temporary file: " $tempScriptName
cmd /c echo "Y`r" | plink.exe $linuxIP -ssh -l "asplab" -pw $AdminPassword -m $tempScriptName

Remove-Item $tempScriptName
}

Expand Down Expand Up @@ -210,7 +211,12 @@ function GetLocationNameArray



Select-AzureRmSubscription -SubscriptionID $SubscriptionId
$currentSubscription = (Get-AzureRmContext).Subscription
if ($currentSubscription.SubscriptionId -ne $SubscriptionId)
{
Write-Host "Setting current subscription"
Select-AzureRmSubscription -SubscriptionID $SubscriptionId
}

# validate passed in locations
$azureLocations = ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute).ResourceTypes | Where-Object ResourceTypeName -eq virtualMachines).Locations
Expand Down
17 changes: 16 additions & 1 deletion infra/AzureTestCellDeployment/Deploy-WinLinux-TestCell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,22 @@ if (-not $res)
$TemplateFile = "Windows-Linux_CellDeployment.json"
$TemplateFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateFile)

Select-AzureRmSubscription -SubscriptionID $SubscriptionId
$currentSubscription = (Get-AzureRmContext).Subscription
if ($currentSubscription.SubscriptionId -ne $SubscriptionId)
{
Write-Host "Setting current subscription"
Select-AzureRmSubscription -SubscriptionID $SubscriptionId
}

# validate location
$azureLocations = ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute).ResourceTypes | Where-Object ResourceTypeName -eq virtualMachines).Locations
if (-not $azureLocations.Contains($ResourceGroupLocation) )
{
Write-Host "Error: Invalid location specified. The location '" $ResourceGroupLocation "' does not exist or does not support VMs"
Write-Host "Valid locations are:"
$azureLocations
return
}

# Create or update the resource group using the specified template file and template parameters file
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop
Expand Down
17 changes: 16 additions & 1 deletion infra/AzureTestCellDeployment/Deploy-WinWin-TestCell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,22 @@ if ($ResourceGroupName.Length -gt 10)
$TemplateFile = "Windows-Windows_CellDeployment.json"
$TemplateFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateFile)

Select-AzureRmSubscription -SubscriptionID $SubscriptionId
$currentSubscription = (Get-AzureRmContext).Subscription
if ($currentSubscription.SubscriptionId -ne $SubscriptionId)
{
Write-Host "Setting current subscription"
Select-AzureRmSubscription -SubscriptionID $SubscriptionId
}

# validate location
$azureLocations = ((Get-AzureRmResourceProvider -ProviderNamespace Microsoft.Compute).ResourceTypes | Where-Object ResourceTypeName -eq virtualMachines).Locations
if (-not $azureLocations.Contains($ResourceGroupLocation) )
{
Write-Host "Error: Invalid location specified. The location '" $ResourceGroupLocation "' does not exist or does not support VMs"
Write-Host "Valid locations are:"
$azureLocations
return
}

# Create or update the resource group using the specified template file and template parameters file
Write-Host "Creating Resource Group"
Expand Down
8 changes: 2 additions & 6 deletions infra/AzureTestCellDeployment/LinuxSetup.ssh
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#cd ~
#sudo mkdir /mnt/logshare
#sudo mount -t cifs //fastfs.file.core.windows.net/testruns /mnt/logshare -o vers=3.0,username=<shareUserName>,password=<shareKey>,dir_mode=0777,file_mode=0777

sudo apt-get -y install git
git clone https://github.com/SajayAntony/cmdport.git
sudo ./cmdport/scripts/install.sh <mqttBroker> <mqttUserName> <mqttPassword>
git clone https://github.com/aspnet/Wave.git
Copy link
Member

Choose a reason for hiding this comment

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

Thanks 👍

sudo ./Wave/scripts/install.sh <mqttBroker> <mqttUserName> <mqttPassword>
9 changes: 5 additions & 4 deletions infra/AzureTestCellDeployment/WindowsVmSetup-Core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Param(
[string] [Parameter(Mandatory=$true)] $MqttPassword
)

# Turn off firewall. Azure security group settings control external access. Intra Test Cell connections should be available
& netsh advfirewall set allprofiles state off
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we have to do the same for Linux ?


mkdir c:\StartupConfig
mkdir c:\WinConfig

Expand All @@ -33,8 +36,6 @@ $autoLogonRegContent = $autoLogonRegContent -replace "<adminUser>", $AdminUser
$autoLogonRegContent = $autoLogonRegContent -replace "<adminPassword>", $AdminPassword
$autoLogonRegContent | Set-Content c:\StartupConfig\EnableAutoLogon.reg
$result = cmd /c regedit.exe /S c:\StartupConfig\EnableAutoLogon.reg 2`>`&1
$result = "Autologon config complete " + $result
Write-Output $result

#configure logon startup script
<#
Expand All @@ -45,8 +46,8 @@ powershell "& {c:\WinConfig\CmdPortInstall.ps1 -target_dir 'c:\cmdport' -broker
"@
#>
$startUpBatchFileContent = @"
powershell.exe -command "& {[System.IO.Directory]::Delete('c:\cmdport',1) }" 2>&1 > C:\StartupConfig\CmdPortDelete.log
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "&{`$target='c:\cmdport\';`$broker='$MqttBroker';`$username='$MqttUser';`$password='$MqttPassword';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/SajayAntony/cmdport/master/scripts/Install.ps1'))}" 2>&1 > c:\StartupConfig\CmdPortInstall.log
powershell.exe -command "& {[System.IO.Directory]::Delete('c:\Wave',1) }" 2>&1 > C:\StartupConfig\WaveDelete.log
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "&{`$target='c:\Wave\';`$broker='$MqttBroker';`$username='$MqttUser';`$password='$MqttPassword';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Wave/master/scripts/Install.ps1'))}" 2>&1 > c:\StartupConfig\WaveInstall.log
"@

$startUpBatchFileContent | Set-Content c:\StartupConfig\Startup.bat
Expand Down