Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor all deployments to use the MSI package. #3284

Merged
merged 64 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d1ff2f1
draft
gtrevi Feb 20, 2024
0e845bb
wip
gtrevi Feb 20, 2024
1374da1
wip
gtrevi Feb 20, 2024
3dbe126
wip
gtrevi Feb 20, 2024
84ae920
wip
gtrevi Feb 20, 2024
578d704
wip
gtrevi Feb 20, 2024
02b6eff
wip
gtrevi Feb 21, 2024
b82292a
wip
gtrevi Feb 21, 2024
126576a
wip
gtrevi Feb 21, 2024
66524a5
wip
gtrevi Feb 21, 2024
1d5712e
Merge branch 'main' of https://github.com/gtrevi/ebpf-for-windows int…
gtrevi Feb 21, 2024
69c5de3
wip
gtrevi Feb 21, 2024
df3e417
wip
gtrevi Feb 21, 2024
208e718
wip
gtrevi Feb 21, 2024
3257784
wip
gtrevi Feb 21, 2024
19d5f62
wip
gtrevi Feb 21, 2024
f44d4ba
wip
gtrevi Feb 21, 2024
30ffe7b
wip
gtrevi Feb 21, 2024
dc9947b
wip
gtrevi Feb 21, 2024
5fcc30f
wip
gtrevi Mar 12, 2024
f95ba58
Merge branch main into gtrevi/refactor-all-deployments-with-msi
gtrevi Mar 12, 2024
ab1e486
wip
gtrevi Mar 12, 2024
d1ecbeb
wip
gtrevi Mar 12, 2024
218e948
test
gtrevi Mar 12, 2024
2d6acd8
wip
gtrevi Mar 12, 2024
d815a81
wip
gtrevi Mar 12, 2024
f1cc5f8
test
gtrevi Mar 12, 2024
4a3df2d
test
gtrevi Mar 12, 2024
ed79631
wip
gtrevi Mar 12, 2024
b4edf2a
test
gtrevi Mar 12, 2024
f950fde
wip
gtrevi Mar 12, 2024
d415584
wip
gtrevi Mar 12, 2024
666c25f
wip
gtrevi Mar 12, 2024
2a969e9
test
gtrevi Mar 12, 2024
77163e0
wip
gtrevi Mar 12, 2024
6b725eb
wip
gtrevi Mar 12, 2024
e81e017
Merge branch 'microsoft:main' into gtrevi/refactor-all-deployments-wi…
gtrevi Mar 13, 2024
a404924
fix debug installation
gtrevi Mar 14, 2024
bb8f710
update VM install doc
gtrevi Mar 14, 2024
85f192e
wip
gtrevi Mar 14, 2024
dbdc7d0
wip
gtrevi Mar 14, 2024
d28c36c
wip
gtrevi Mar 14, 2024
4168b4c
wip
gtrevi Mar 14, 2024
f596a29
wip
gtrevi Mar 15, 2024
5fcda40
improve msi log readability
gtrevi Mar 15, 2024
5c7a751
Merge branch 'microsoft:main' into gtrevi/refactor-all-deployments-wi…
gtrevi Mar 15, 2024
c54357d
wip
gtrevi Mar 15, 2024
d6bdc61
debug
gtrevi Mar 16, 2024
2c34eb8
Merge branch 'microsoft:main' into gtrevi/refactor-all-deployments-wi…
gtrevi Mar 18, 2024
27bee8f
Merge branch 'microsoft:main' into gtrevi/refactor-all-deployments-wi…
gtrevi Mar 19, 2024
765a464
nits
gtrevi Mar 19, 2024
99daf20
Merge branch 'main' into gtrevi/refactor-all-deployments-with-msi
gtrevi Mar 19, 2024
551db72
feedback
gtrevi Mar 20, 2024
9244e7b
nl
gtrevi Mar 20, 2024
37eb2c5
updates
gtrevi Mar 20, 2024
b9dcbe2
add extra stop-check
gtrevi Mar 20, 2024
e9af4a2
wip
gtrevi Mar 20, 2024
1a0d260
wip
gtrevi Mar 21, 2024
358ca0b
nit
gtrevi Mar 21, 2024
636c06e
fix
gtrevi Mar 21, 2024
5c521f1
doc
gtrevi Mar 21, 2024
17f3ebc
exclude doc
gtrevi Mar 21, 2024
12a1fce
Merge main
gtrevi Mar 21, 2024
f482fde
sync
gtrevi Mar 21, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT

# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
Expand Down
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT

repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.3
Expand Down
5 changes: 2 additions & 3 deletions scripts/check_msi_installation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ function Install-MsiPackage {

$res = $true

$arguments = "/i $MsiPath /qn /norestart /log msi-install.log $MsiAdditionalArguments"
$arguments = "/i $MsiPath /qn /norestart /l*v msi-install.log $MsiAdditionalArguments"
gtrevi marked this conversation as resolved.
Show resolved Hide resolved
Write-Host "Installing MSI package with arguments: '$arguments'..."
$process = Start-Process -FilePath msiexec.exe -ArgumentList $arguments -Wait -PassThru

if ($process.ExitCode -eq 0) {
Write-Host "Installation successful!"
} else {
Expand All @@ -105,7 +104,7 @@ function Uninstall-MsiPackage {

Write-Host "Uninstalling MSI package..."
$res = $true
$process = Start-Process -FilePath msiexec.exe -ArgumentList "/x $MsiPath /qn /norestart /log msi-uninstall.log" -Wait -PassThru
$process = Start-Process -FilePath msiexec.exe -ArgumentList "/x $MsiPath /qn /norestart /l*v msi-uninstall.log" -Wait -PassThru
if ($process.ExitCode -eq 0) {
Write-Host "Uninstallation successful!"
} else {
Expand Down
8 changes: 8 additions & 0 deletions scripts/cleanup_ebpf_cicd_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ $TestVMCredential = Get-StoredCredential -Target $Target -ErrorAction Stop
# Load other utility modules.
Import-Module .\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue
Import-Module .\config_test_vm.psm1 -Force -ArgumentList ($TestVMCredential.UserName, $TestVMCredential.Password, $WorkingDirectory, $LogFileName) -WarningAction SilentlyContinue
Import-Module .\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

# Read the test execution json.
$TestExecutionConfig = Get-Content ("{0}\{1}" -f $PSScriptRoot, $TestExecutionJsonFileName) | ConvertFrom-Json
$VMList = $TestExecutionConfig.VMMap.$SelfHostedRunnerName

# Uninstall eBPF Components on the test VM.
foreach($VM in $VMList) {
$VMName = $VM.Name
Write-Host "Uninstalling eBPF components on VM $VMName..."
Uninstall-eBPFComponentsOnVM -VMName $VMname -ErrorAction Stop
gtrevi marked this conversation as resolved.
Show resolved Hide resolved
}

# Import logs from VMs.
Import-ResultsFromVM -VMList $VMList -KmTracing $KmTracing

Expand Down
86 changes: 61 additions & 25 deletions scripts/config_test_vm.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function Export-BuildArtifactsToVMs
&tar @("cfz", "$tempFileName", "*")
Write-Log "Created $tempFileName containing files in $pwd"

# Copy artifacts to the given VM list.
foreach($VM in $VMList) {
$VMName = $VM.Name
$TestCredential = New-Credential -Username $Admin -AdminPassword $AdminPassword
Expand Down Expand Up @@ -210,6 +211,52 @@ function Export-BuildArtifactsToVMs
Remove-Item -Force $tempFileName
}

#
# Install eBPF components on VM.
#

function Install-eBPFComponentsOnVM
gtrevi marked this conversation as resolved.
Show resolved Hide resolved
{
param([parameter(Mandatory=$true)][string] $VMName,
[parameter(Mandatory=$true)][bool] $KmTracing,
[parameter(Mandatory=$true)][string] $KmTraceType)

Write-Log "Installing eBPF components on $VMName"
$TestCredential = New-Credential -Username $Admin -AdminPassword $AdminPassword

Invoke-Command -VMName $VMName -Credential $TestCredential -ScriptBlock {
param([Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName,
[Parameter(Mandatory=$true)] [bool] $KmTracing,
[Parameter(Mandatory=$true)] [string] $KmTraceType)
$WorkingDirectory = "$env:SystemDrive\$WorkingDirectory"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

Install-eBPFComponents -KmTracing $KmTracing -KmTraceType $KmTraceType -KMDFVerifier $true -ErrorAction Stop
gtrevi marked this conversation as resolved.
Show resolved Hide resolved
} -ArgumentList ("eBPF", $LogFileName, $KmTracing, $KmTraceType) -ErrorAction Stop
Write-Log "eBPF components installed on $VMName" -ForegroundColor Green
}

function Uninstall-eBPFComponentsOnVM
{
param([parameter(Mandatory=$true)][string] $VMName)

Write-Log "Unnstalling eBPF components on $VMName"
$TestCredential = New-Credential -Username $Admin -AdminPassword $AdminPassword

Invoke-Command -VMName $VMName -Credential $TestCredential -ScriptBlock {
param([Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName)
$WorkingDirectory = "$env:SystemDrive\$WorkingDirectory"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

Uninstall-eBPFComponents
} -ArgumentList ("eBPF", $LogFileName) -ErrorAction Stop
Write-Log "eBPF components uninstalled on $VMName" -ForegroundColor Green
}

function ArchiveKernelModeDumpOnVM
{
param (
Expand Down Expand Up @@ -331,7 +378,6 @@ function Import-ResultsFromVM
if (!(Test-Path ".\TestLogs\$VMName\Logs")) {
New-Item -ItemType Directory -Path ".\TestLogs\$VMName\Logs"
}

$VMTemp = Invoke-Command -Session $VMSession -ScriptBlock {return $Env:TEMP}
Write-Log ("Copy $LogFileName from $VMTemp on $VMName to $pwd\TestLogs")
Copy-Item `
Expand Down Expand Up @@ -436,30 +482,9 @@ function Import-ResultsFromVM
Move-Item "$env:TEMP\$LogFileName" -Destination ".\TestLogs" -Force -ErrorAction Ignore 2>&1 | Write-Log
}

function Install-eBPFComponentsOnVM
{
param([parameter(Mandatory=$true)][string] $VMName,
[parameter(Mandatory=$true)][bool] $KmTracing,
[parameter(Mandatory=$true)][string] $KmTraceType)

Write-Log "Installing eBPF components on $VMName"
$TestCredential = New-Credential -Username $Admin -AdminPassword $AdminPassword

Invoke-Command -VMName $VMName -Credential $TestCredential -ScriptBlock {
param([Parameter(Mandatory=$True)] [string] $WorkingDirectory,
[Parameter(Mandatory=$True)] [string] $LogFileName,
[Parameter(Mandatory=$true)] [bool] $KmTracing,
[Parameter(Mandatory=$true)] [string] $KmTraceType)
$WorkingDirectory = "$env:SystemDrive\$WorkingDirectory"
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

Install-eBPFComponents -KmTracing $KmTracing -KmTraceType $KmTraceType -KMDFVerifier $true
Enable-KMDFVerifier
} -ArgumentList ("eBPF", $LogFileName, $KmTracing, $KmTraceType) -ErrorAction Stop
Write-Log "eBPF components installed on $VMName" -ForegroundColor Green
}

#
# Configure network adapters on VMs.
#
function Initialize-NetworkInterfacesOnVMs
{
param([parameter(Mandatory=$true)] $VMMap)
Expand Down Expand Up @@ -535,3 +560,14 @@ function Get-Duonic {
Move-Item -Path "$DownloadPath\corenet-ci-main\vm-setup\notmyfault64.exe" -Destination $pwd -Force
Remove-Item -Path $DownloadPath -Force -Recurse
}

# Download the Visual C++ Redistributable.
function Get-VCRedistributable {
$url = "https://aka.ms/vs/16/release/vc_redist.x64.exe"
$DownloadPath = "$pwd\vc-redist"
mkdir $DownloadPath
Write-Host "Downloading Visual C++ Redistributable from $url to $DownloadPath"
Invoke-WebRequest -Uri $url -OutFile "$DownloadPath\vc_redist.x64.exe"
Move-Item -Path "$DownloadPath\vc_redist.x64.exe" -Destination $pwd -Force
Remove-Item -Path $DownloadPath -Force -Recurse
}
4 changes: 2 additions & 2 deletions scripts/execute_ebpf_cicd_tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ $AdminTestVMCredential = Get-StoredCredential -Target $AdminTarget -ErrorAction
$StandardUserTestVMCredential = Get-StoredCredential -Target $StandardUserTarget -ErrorAction Stop

# Load other utility modules.
Import-Module .\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue
Import-Module .\vm_run_tests.psm1 `
Import-Module $PSScriptRoot\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue
Import-Module $PSScriptRoot\vm_run_tests.psm1 `
-Force `
-ArgumentList (
$AdminTestVMCredential.UserName,
Expand Down
Loading
Loading