Skip to content

Commit

Permalink
convert CI agent provisioning scripts to manifests (#566)
Browse files Browse the repository at this point in the history
* convert CI agent provisioning scripts to manifests

* actually validate agent config in CI

* escape^2

* try again

* unchange wil?

* further changes

* try doing the verifier quotes a different way

* double down on quotes

* double quotes again
  • Loading branch information
mtfriesen authored Jun 19, 2024
1 parent 5344517 commit d536bb2
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 85 deletions.
28 changes: 28 additions & 0 deletions .azure/agents/functional.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"artifacts": [
{
"name": "windows-gitinstall",
"parameters": {
"SetCredHelper": "false"
}
},
{
"name": "windows-bcdedit-testsigning",
"parameters": {
"TestSigningOption": "On"
}
},
{
"name": "windows-powershell-invokecommand",
"parameters": {
"Script": "verifier.exe /standard /driver xdp.sys fnmp.sys fnlwf.sys ndis.sys ebpfcore.sys; exit 0; <# Enable verifier on XDP-related drivers. Mask the verifier.exe non-zero exit code. #>"
}
},
{
"name": "windows-powershell-invokecommand",
"parameters": {
"Script": "reg.exe add HKLM`\\System`\\CurrentControlSet`\\Control`\\CrashControl /v CrashDumpEnabled /d 1 /t REG_DWORD /f; <# Enable complete system crash dumps. #>"
}
}
]
}
40 changes: 40 additions & 0 deletions .azure/agents/spinxsk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"artifacts": [
{
"name": "windows-gitinstall",
"parameters": {
"SetCredHelper": "false"
}
},
{
"name": "windows-bcdedit-testsigning",
"parameters": {
"TestSigningOption": "On"
}
},
{
"name": "windows-powershell-invokecommand",
"parameters": {
"Script": "verifier.exe /standard /faults 599 \"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\" \"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\" 1 /driver xdp.sys ebpfcore.sys; exit 0; <# Failure probability (599/10000 = 5.99%). If left to the default value, roughly every 5 minutes verifier will fail all allocations within a 10 interval. This behavior complicates the spinxsk socket setup statistics. Setting it to a non-default value disables this behavior. 1 - Delay (in minutes) after boot until simulation engages. This is the lowest value configurable via verifier.exe. Mask the verifier.exe non-zero exit code. #>"
}
},
{
"name": "windows-powershell-invokecommand",
"parameters": {
"Script": "reg.exe add HKLM`\\SYSTEM`\\CurrentControlSet`\\Services`\\netbt /v Start /d 4 /t REG_DWORD /f; <# Disable TDX and its dependent service NetBT. These drivers are implicated in some NDIS control path hangs. #>"
}
},
{
"name": "windows-powershell-invokecommand",
"parameters": {
"Script": "reg.exe add HKLM`\\SYSTEM`\\CurrentControlSet`\\Services`\\tdx /v Start /d 4 /t REG_DWORD /f; <# Disable TDX and its dependent service NetBT. These drivers are implicated in some NDIS control path hangs. #>"
}
},
{
"name": "windows-powershell-invokecommand",
"parameters": {
"Script": "reg.exe add HKLM`\\System`\\CurrentControlSet`\\Control`\\CrashControl /v CrashDumpEnabled /d 1 /t REG_DWORD /f; <# Enable complete system crash dumps. #>"
}
}
]
}
20 changes: 0 additions & 20 deletions .azure/scripts/agent-functionaltest/Setup.ps1

This file was deleted.

55 changes: 0 additions & 55 deletions .azure/scripts/agent-spinxsktest/Setup.ps1

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForFunctionalTest -NoReboot -Verbose
run: tools/prepare-machine.ps1 -ForFunctionalTest -RequireNoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForSpinxskTest -NoReboot -Verbose
run: tools/prepare-machine.ps1 -ForSpinxskTest -RequireNoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForPerfTest -NoReboot -Verbose
run: tools/prepare-machine.ps1 -ForPerfTest -RequireNoReboot -Verbose
- name: Download Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
Expand Down Expand Up @@ -281,7 +281,7 @@ jobs:
run: tools/check-drivers.ps1 -Config ${{ matrix.configuration }} -Arch ${{ matrix.platform }} -Verbose
- name: Prepare Machine
shell: PowerShell
run: tools/prepare-machine.ps1 -ForFunctionalTest -NoReboot -Verbose -UseJitEbpf
run: tools/prepare-machine.ps1 -ForFunctionalTest -RequireNoReboot -Verbose -UseJitEbpf
- name: Download Artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
Expand Down
28 changes: 22 additions & 6 deletions tools/prepare-machine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ This prepares a machine for running XDP.
.PARAMETER NoReboot
Does not reboot the machine.
.PARAMETER RequireNoReboot
Returns an error if a reboot is needed.
.PARAMETER UseJitEbpf
Installs eBPF with JIT mode. Needed for backward compatibility tests.
Expand Down Expand Up @@ -59,6 +62,9 @@ param (
[Parameter(Mandatory = $false)]
[switch]$NoReboot = $false,

[Parameter(Mandatory = $false)]
[switch]$RequireNoReboot = $false,

[Parameter(Mandatory = $false)]
[switch]$Force = $false,

Expand All @@ -84,6 +90,10 @@ if (!$ForBuild -and !$ForEbpfBuild -and !$ForTest -and !$ForFunctionalTest -and
# Flag that indicates something required a reboot.
$Reboot = $false

if ($RequireNoReboot) {
$script:NoReboot = $true
}

# Log the OS version.
Write-Verbose "Querying OS BuildLabEx"
(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').BuildLabEx | Write-Verbose
Expand Down Expand Up @@ -362,10 +372,16 @@ if ($Cleanup) {
}
}

if ($Reboot -and !$NoReboot) {
# Reboot the machine.
Write-Host "Rebooting..."
shutdown.exe /f /r /t 0
} elseif ($Reboot) {
Write-Host "Reboot required."
if ($Reboot) {
if ($RequireNoReboot) {
Write-Error "Reboot required but disallowed"
} elseif ($NoReboot) {
Write-Verbose "Reboot required"
return @{"RebootRequired" = $true}
} else {
Write-Host "Rebooting..."
shutdown.exe /f /r /t 0
}
} else {
return $null
}

0 comments on commit d536bb2

Please sign in to comment.