Skip to content

Commit

Permalink
Run ITPro tests based on flavor
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Egil Ring <[email protected]>
  • Loading branch information
janegilring committed Jul 9, 2024
1 parent 63bd054 commit 4412fcd
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,17 @@ $payLoad = @"
$VMs = @("ArcBox-SQL", "ArcBox-Ubuntu-01", "ArcBox-Ubuntu-02", "ArcBox-Win2K19", "ArcBox-Win2K22")
$VMs | ForEach-Object -Parallel {
$null = Connect-AzAccount -Identity -Tenant $tenantId -Subscription $subscriptionId -Scope Process -WarningAction SilentlyContinue

$vm = $PSItem
$connectedMachine = Get-AzConnectedMachine -Name $vm -ResourceGroupName $resourceGroup -SubscriptionId $subscriptionId
$connectedMachineEndpoint = (Invoke-AzRestMethod -Method get -Path "$($connectedMachine.Id)/providers/Microsoft.HybridConnectivity/endpoints/default?api-version=2023-03-15").Content | ConvertFrom-Json

if (-not ($connectedMachineEndpoint.properties | Where-Object { $_.type -eq "default" -and $_.provisioningState -eq "Succeeded" })) {
Write-Output "Creating default endpoint for $($connectedMachine.Name)"
$null = Invoke-AzRestMethod -Method put -Path "$($connectedMachine.Id)/providers/Microsoft.HybridConnectivity/endpoints/default?api-version=2023-03-15" -Payload '{"properties": {"type": "default"}}'
}
$connectedMachineSshEndpoint = (Invoke-AzRestMethod -Method get -Path "$($connectedMachine.Id)/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH?api-version=2023-03-15").Content | ConvertFrom-Json

if (-not ($connectedMachineSshEndpoint.properties | Where-Object { $_.serviceName -eq "SSH" -and $_.provisioningState -eq "Succeeded" })) {
Write-Output "Enabling SSH on $($connectedMachine.Name)"
$null = Invoke-AzRestMethod -Method put -Path "$($connectedMachine.Id)/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH?api-version=2023-03-15" -Payload '{"properties": {"serviceName": "SSH", "port": 22}}'
Expand All @@ -441,7 +441,7 @@ $payLoad = @"
Write-Output "SSH already enabled on $($connectedMachine.Name)"
}
}
}
}
elseif ($Env:flavor -eq "DataOps") {
Write-Header "Enabling SSH access to Arc-enabled servers"
$null = Connect-AzAccount -Identity -Tenant $tenantId -Subscription $subscriptionId -Scope Process -WarningAction SilentlyContinue
Expand All @@ -451,7 +451,7 @@ $payLoad = @"
Write-Output "Creating default endpoint for $($connectedMachine.Name)"
$null = Invoke-AzRestMethod -Method put -Path "$($connectedMachine.Id)/providers/Microsoft.HybridConnectivity/endpoints/default?api-version=2023-03-15" -Payload '{"properties": {"type": "default"}}'
}

$connectedMachineSshEndpoint = (Invoke-AzRestMethod -Method get -Path "$($connectedMachine.Id)/providers/Microsoft.HybridConnectivity/endpoints/default/serviceconfigurations/SSH?api-version=2023-03-15").Content | ConvertFrom-Json
if (-not ($connectedMachineSshEndpoint.properties | Where-Object { $_.serviceName -eq "SSH" -and $_.provisioningState -eq "Succeeded" })) {
Write-Output "Enabling SSH on $($connectedMachine.Name)"
Expand All @@ -478,9 +478,13 @@ Convert-JSImageToBitMap -SourceFilePath "$Env:ArcBoxDir\wallpaper.png" -Destinat

Set-JSDesktopBackground -ImagePath "$Env:ArcBoxDir\wallpaper.bmp"

Write-Header "Running tests to verify infrastructure"
if ($Env:flavor -eq "ITPro") {

Write-Header "Running tests to verify infrastructure"

& "$Env:ArcBoxTestsDir\Invoke-Test.ps1"
& "$Env:ArcBoxTestsDir\Invoke-Test.ps1"

}

Write-Header "Creating deployment logs bundle"

Expand Down

0 comments on commit 4412fcd

Please sign in to comment.