diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 029e772fd8..7939984aca 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,6 +23,10 @@ parameters: displayName: 'githubBranch' type: string default: 'arcbox_3.0' +- name: flavor + displayName: 'flavor' + type: string + default: 'ITPro' variables: - group: 'integration-tests' @@ -32,6 +36,8 @@ variables: value: ${{parameters.githubAccount}} - name: githubBranch value: ${{parameters.githubBranch}} +- name: flavor + value: ${{parameters.flavor}} stages: - stage: 'ArcBox_deployment' @@ -70,6 +76,7 @@ stages: Write-Host "Deploying to $(ResourceGroupName)" $githubAccount = "$(githubAccount)" $githubBranch = "$(githubBranch)" + $flavor = "$(flavor)" if ($githubAccount -ne "microsoft") { Write-Host "Checking out $githubAccount/$githubBranch" git remote add upstream https://github.com/$($githubAccount)/azure_arc.git @@ -87,7 +94,7 @@ stages: windowsAdminPassword = "$(windowsAdminPassword)" ; ` sshRSAPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCsdlSaF10Uw0fFysiIV0VYeJGE1CaV0ZjZcakcKgafiqZ04sAzf7KnoIjPVyx6LXoDTKGtv1e5eFjRZA7Z0Bu+a3JqY252/yr/B2R3Mu5qZHbKFncpVEXn7sUmYk4rDG5vToFxbhpKX5EGyvM1M0quoUv3Uv9reBsSDdjk7n7oA2Q+89rj4nfRuTEMQRwvNBaLeNRSlWuzPq4EkpwxSWRzIC2auC5K0rxGiTMPTXMOQ3l0DvzKRoEsygHA4c3uw0PTntSlgSSTgtGdQfuX63hAD4QPTVfeQdsW5+Nq3clr+6SHgeGdwHhKjUVTF+E2olfSYtuV4CqPW8dZdDBOZg7pXLMSVumZVKCZiUV6uBJkvLBRMzMiFsfXOVrgyThMqq+8y4tg/V3l/3S8z5Lngy4WoCAQMHQ1SloPmy9s4QnbjCFEQx/cIq9H+Uw6HAYhdQFh/w/tuIP+KIqOpMOrltZuaoqx3AOOL3BPXJMbv3opiZxCEZQFf68n+Zn6uRc9u1EENA9s1DrjG1j/CHWzbX/t63Ig/xQLgKLu9T+evua3dcWsYc3j1Gvk8R+ioXV7x0/fi6twrhSQxBIIL0D2Pxm8TBfJ3mVXk0kYGGq1mBsoxAzjoBhcbdwUMXHbAksj4/UuuAK5VfH278hlXo/BHSgDLZ98fdS63nq7rIr6qWmBrQ==" ; ` logAnalyticsWorkspaceName = "arcbox-la" ; ` - flavor = "ITPro" ; ` + flavor = $flavor ; ` deployBastion = $false ; ` githubAccount = $githubAccount ; ` githubBranch = $githubBranch ; ` diff --git a/azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1 b/azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1 index 39c5ccb8e0..31b8cb123f 100644 --- a/azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1 +++ b/azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1 @@ -463,50 +463,7 @@ Set-JSDesktopBackground -ImagePath "$Env:ArcBoxDir\wallpaper.bmp" Write-Header "Running tests to verify infrastructure" -Invoke-Pester -Path "$Env:ArcBoxTestsDir\common.tests.ps1" -Output Detailed -PassThru -OutVariable tests_common -$tests_passed = $tests_common.Passed.Count -$tests_failed = $tests_common.Failed.Count - -switch ($env:flavor) { - 'DevOps' { - Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops - $tests_passed = $tests_passed + $tests_devops.Passed.Count - $tests_failed = $tests_failed + $tests_devops.Failed.Count -} - 'DataOps' { - Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -Output Detailed -PassThru -OutVariable tests_dataops - $tests_passed = $tests_passed + $tests_dataops.Passed.Count - $tests_failed = $tests_failed + $tests_dataops.Failed.Count - } - 'ITPro' { - Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro - $tests_passed = $tests_passed + $tests_itpro.Passed.Count - $tests_failed = $tests_failed + $tests_itpro.Failed.Count -} - 'Full' { - Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops - $tests_passed = $tests_passed + $tests_devops.Passed.Count - $tests_failed = $tests_failed + $tests_devops.Failed.Count - - Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_dataops - $tests_passed = $tests_passed + $tests_dataops.Passed.Count - $tests_failed = $tests_failed + $tests_dataops.Failed.Count - - Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro - $tests_passed = $tests_passed + $tests_itpro.Passed.Count - $tests_failed = $tests_failed + $tests_itpro.Failed.Count - } -} - -Write-Output "Tests succeeded: $tests_passed" -Write-Output "Tests failed: $tests_failed" - -Write-Header "Adding deployment test results to wallpaper using BGInfo" - -Set-Content "$Env:windir\TEMP\arcbox-tests-succeeded.txt" $tests_passed -Set-Content "$Env:windir\TEMP\arcbox-tests-failed.txt" $tests_failed - -bginfo.exe $Env:ArcBoxTestsDir\arcbox-bginfo.bgi /timer:0 /NOLICPROMPT +& "$Env:ArcBoxTestsDir\Invoke-Test.ps1" Write-Header "Creating deployment logs bundle" diff --git a/azure_jumpstart_arcbox/artifacts/Bootstrap.ps1 b/azure_jumpstart_arcbox/artifacts/Bootstrap.ps1 index 2b57d2ba12..be11877bb0 100644 --- a/azure_jumpstart_arcbox/artifacts/Bootstrap.ps1 +++ b/azure_jumpstart_arcbox/artifacts/Bootstrap.ps1 @@ -132,6 +132,9 @@ foreach ($module in $modules) { Install-PSResource -Name $module -Scope AllUsers -Quiet -AcceptLicense -TrustRepository } +# Temporary workaround for Posh-SSH module due to: https://github.com/darkoperator/Posh-SSH/issues/558 +Install-PSResource -Name Posh-SSH -Scope AllUsers -Quiet -AcceptLicense -TrustRepository -Prerelease + # Installing DHCP service Write-Output "Installing DHCP service" Install-WindowsFeature -Name "DHCP" -IncludeManagementTools diff --git a/azure_jumpstart_arcbox/artifacts/integration_tests/scripts/Send-PesterResult.ps1 b/azure_jumpstart_arcbox/artifacts/integration_tests/scripts/Send-PesterResult.ps1 index 17281f6e85..720dd72940 100644 --- a/azure_jumpstart_arcbox/artifacts/integration_tests/scripts/Send-PesterResult.ps1 +++ b/azure_jumpstart_arcbox/artifacts/integration_tests/scripts/Send-PesterResult.ps1 @@ -4,7 +4,22 @@ Write-Output "Get-PesterResult.ps1 started in $(hostname.exe) as user $(whoami.e $timeout = New-TimeSpan -Minutes 180 $endTime = (Get-Date).Add($timeout) -$logFilePath = "C:\ArcBox\Logs\ArcServersLogonScript.log" + + +switch ($env:flavor) { + 'DevOps' { + $logFilePath = "$Env:ArcBoxLogsDir\DevOpsLogonScript.log" +} + 'DataOps' { + $logFilePath = "$Env:ArcBoxLogsDir\DataOpsLogonScript.log" + } + 'ITPro' { + $logFilePath = "$Env:ArcBoxLogsDir\ArcServersLogonScript.log" + } + 'default' { + throw "Unknown flavor $env:flavor" + } +} Write-Output "Adding Storage Blob Data Contributor role assignment to SPN $env:spnClientId for allowing upload of Pester test results to Azure Storage" diff --git a/azure_jumpstart_arcbox/artifacts/tests/Invoke-Test.ps1 b/azure_jumpstart_arcbox/artifacts/tests/Invoke-Test.ps1 new file mode 100644 index 0000000000..6e01deba33 --- /dev/null +++ b/azure_jumpstart_arcbox/artifacts/tests/Invoke-Test.ps1 @@ -0,0 +1,44 @@ +Invoke-Pester -Path "$Env:ArcBoxTestsDir\common.tests.ps1" -Output Detailed -PassThru -OutVariable tests_common +$tests_passed = $tests_common.Passed.Count +$tests_failed = $tests_common.Failed.Count + +switch ($env:flavor) { + 'DevOps' { + Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops + $tests_passed = $tests_passed + $tests_devops.Passed.Count + $tests_failed = $tests_failed + $tests_devops.Failed.Count +} + 'DataOps' { + Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -Output Detailed -PassThru -OutVariable tests_dataops + $tests_passed = $tests_passed + $tests_dataops.Passed.Count + $tests_failed = $tests_failed + $tests_dataops.Failed.Count + } + 'ITPro' { + Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro + $tests_passed = $tests_passed + $tests_itpro.Passed.Count + $tests_failed = $tests_failed + $tests_itpro.Failed.Count +} + 'Full' { + Invoke-Pester -Path "$Env:ArcBoxTestsDir\devops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_devops + $tests_passed = $tests_passed + $tests_devops.Passed.Count + $tests_failed = $tests_failed + $tests_devops.Failed.Count + + Invoke-Pester -Path "$Env:ArcBoxTestsDir\dataops.tests.ps1" -Output Detailed -PassThru -OutVariable tests_dataops + $tests_passed = $tests_passed + $tests_dataops.Passed.Count + $tests_failed = $tests_failed + $tests_dataops.Failed.Count + + Invoke-Pester -Path "$Env:ArcBoxTestsDir\itpro.tests.ps1" -Output Detailed -PassThru -OutVariable tests_itpro + $tests_passed = $tests_passed + $tests_itpro.Passed.Count + $tests_failed = $tests_failed + $tests_itpro.Failed.Count + } +} + +Write-Output "Tests succeeded: $tests_passed" +Write-Output "Tests failed: $tests_failed" + +Write-Header "Adding deployment test results to wallpaper using BGInfo" + +Set-Content "$Env:windir\TEMP\arcbox-tests-succeeded.txt" $tests_passed +Set-Content "$Env:windir\TEMP\arcbox-tests-failed.txt" $tests_failed + +bginfo.exe $Env:ArcBoxTestsDir\arcbox-bginfo.bgi /timer:0 /NOLICPROMPT \ No newline at end of file