4.1 KiB
4.1 KiB
Setup instructions for self-hosted runners
The CI/CD tests for eBPF for Windows
requires installing kernel drivers, that are not supported in Github-hosted runners.
That is why self-host runners are needed to run those tests. The driver
job in the CI/CD
Github workflow (cicd.yml
) runs on self-host runners that use Hyper-V VMs to deploy the eBPF components and run the CI/CD tests on. Using Hyper-V VMs enable the Github workflow to start from a clean state every time the test runs by restoring the VMs to a "baseline" snapshot.
This document discusses the steps to set up such a self-hosted actions-runner that can run the workflow for CI/CD tests on a fork of the eBPF for Windows repo.
- Install Windows Server 2019 - build 17763.
- Download and install action runner following the instructions for Windows x64.
- Create a new self-hosted runner for the fork. This requires administrator permissions in the project. Go to the settings menu in Github UI, select
Actions
->Runners
and click on theNew self-hosted-runner
button. This will generate a token for the self-hosted runner. - Configure action runner as follows:
./config.cmd --url <fork URL> --labels 'ebpf_cicd_tests' --token <action runner token> --runasservice --windowslogonaccount <account> --windowslogonpassword <password>
For the--url
parameter provide the URL to the fork for which self-hosted runner is being configured.
For the--token
parameter provide the token obtained in step 3.
The value for--labels
parameter (ebpf_cicd_tests
) must be the same as theenvironment
field in the job nameddriver
incicd.yml
.
The--runasservice
parameter makes the action runner run as a Windows service. The runner service runs asNetworkService
by default. However, theKernel_Test_VM
workflow performs operations on a test VM that requires administrator privilege. So, the credentials of an account with administrator privilege must be supplied inwindowslogonaccount
andwindowslogonpassword
parameters. - Follow the VM Installation Instructions to set up two test VMs and perform one-time setup steps. Then create a snapshot named baseline for each of the VMs.
- Connect the two test VMs.
- Create a new VMSwitch instance:
New-VMSwitch -Name <VMSwitch Name> -SwitchType Private
- Add two VM NICs on the first VM and one VM NIC on the other VM. Connect the NICs to the private VMSwitch:
Add-VMNetworkAdapter -VMName <VMName> -SwitchName <VMSwitch Name>
- Create a new VMSwitch instance:
- Edit test configuration JSON files.
- Edit
test_execution.json
file. Add the name of the one of the VMs inBasicTest
section. Add the names of both the VMs inMultiVMTest
section along with the "Interfaces" section that must contain information about the network interfaces created in step 7.2 Above. This section must contain the interface alias, and IPv4 and IPv6 addresses. The CICD test automation would apply these IP addresses on the NICs of the test VM. - Edit
vm_list.json
with the names of the two test VMs.
- Edit
- Store the VM administrator credential:
Install-Module CredentialManager -force
New-StoredCredential -Target
TEST_VM
-Username <VM Administrator> -Password <VM Administrator account password> -Persist LocalMachine
- Set up Windows Error Reporting Local Dump Collection on the VMs with the following commands.
New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -ErrorAction SilentlyContinue
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpType" -Value 2 -PropertyType DWord -ErrorAction SilentlyContinue
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Value "c:\dumps" -PropertyType ExpandString -ErrorAction SilentlyContinue -Force
- Reboot the runner.