Skip to content

[draft] copy over 1es files - #385

Draft
Laksh (lakshk98) wants to merge 8 commits into
microsoft:mainfrom
lakshk98:setup-es-runners
Draft

[draft] copy over 1es files#385
Laksh (lakshk98) wants to merge 8 commits into
microsoft:mainfrom
lakshk98:setup-es-runners

Conversation

@lakshk98

Copy link
Copy Markdown
Contributor

Description

Describe the purpose of and changes within this Pull Request.

Testing

Do any existing tests cover this change? Are new tests needed?

Documentation

Is there any documentation impact for this change?

Installation

Is there any installer impact for this change?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a set of PowerShell modules/scripts and workflow updates to support VM-backed driver test execution (including 1ES runner support), along with packaging the required test payload files into build artifacts.

Changes:

  • Add new CI/CD test orchestration scripts/modules for setting up VMs, executing kernel driver tests, collecting logs/dumps/traces, and cleaning up.
  • Extend build/test GitHub workflows to support 1ES runner execution and to bundle required VM test payload files (including an eBPF-for-Windows MSI).
  • Enhance the existing installer download script with additional parameters and signature validation.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
scripts/vm_run_tests.psm1 Adds helpers to run tests on host vs VM and trigger kernel dumps.
scripts/tracing_utils.psm1 Adds simplified WPR ETW tracing helpers.
scripts/test_execution.json Adds VM-to-runner mapping and driver test suite definitions.
scripts/setup_ebpf_cicd_tests.ps1 Adds CI/CD setup script to prep VMs/host for driver tests.
scripts/setup_build/setup_build.vcxproj Adds additional scripts/json into the setup_build copy payload.
scripts/run_driver_tests.psm1 Adds driver test execution wrapper and kernel dump trigger helper.
scripts/Install-eBpfForWindows.ps1 Adds parameters, download-only mode, and Authenticode validation.
scripts/install_ebpf.psm1 Adds MSI-based eBPF component install/stop/uninstall helpers.
scripts/execute_ebpf_cicd_tests.ps1 Adds CI/CD execution script to run selected driver test suites.
scripts/config_test_vm.psm1 Adds VM initialization, artifact export, and result import logic.
scripts/common.psm1 Adds shared logging, timeout/copy helpers, and VM credential utilities.
scripts/cleanup_ebpf_cicd_tests.ps1 Adds CI/CD cleanup script to collect results and stop VMs.
.github/workflows/reusable-test.yml Updates reusable test workflow for 1ES runner paths and longer timeouts.
.github/workflows/reusable-build.yml Downloads MSI into build output and validates required VM payload contents.
.github/workflows/cicd.yml Moves driver tests to 1ES runner execution and adjusts reusable workflow inputs.
Suppressed comments (5)

scripts/execute_ebpf_cicd_tests.ps1:55

  • This Import-Module path is not quoted/constructed; $WorkingDirectory\common.psm1 will not expand as a filesystem path and can fail when WorkingDirectory contains spaces. Use Join-Path (or a quoted string) to build the path.
    Import-Module $WorkingDirectory\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue

scripts/execute_ebpf_cicd_tests.ps1:134

  • This Import-Module path is not quoted/constructed; $WorkingDirectory\common.psm1 will not expand as a filesystem path reliably. Use Join-Path (or a quoted string) to build the module path.
Import-Module $WorkingDirectory\common.psm1 -Force -ArgumentList ($LogFileName) -ErrorAction SilentlyContinue

scripts/config_test_vm.psm1:322

  • Same path construction issue here: $WorkingDirectory\common.psm1 / $WorkingDirectory\install_ebpf.psm1 are not reliably expanded as filesystem paths. Use Join-Path (or a quoted string).
        Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
        Import-Module $WorkingDirectory\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue

scripts/config_test_vm.psm1:347

  • This Import-Module uses $WorkingDirectory\common.psm1, which is not reliable path construction (and can fail if the path has spaces). Use Join-Path (or a quoted string) here as well.
            Import-Module $WorkingDirectory\common.psm1 `

scripts/config_test_vm.psm1:350

  • This Import-Module uses $WorkingDirectory\install_ebpf.psm1, which is not reliable path construction (and can fail if the path has spaces). Use Join-Path (or a quoted string) here as well.
            Import-Module $WorkingDirectory\install_ebpf.psm1 `

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/common.psm1
{
if (![System.String]::IsNullOrEmpty($TraceMessage)) {
$timestamp = (Get-Date).ToString('HH:mm:ss')
Write-Host "[$timestamp] :: $TraceMessage"-ForegroundColor $ForegroundColor
[Parameter(Mandatory=$true)] [string] $WorkingDirectory
)

Import-Module $WorkingDirectory\common.psm1 -Force -ArgumentList ($LogFileName) -WarningAction SilentlyContinue

Push-Location $WorkingDirectory

Import-Module $WorkingDirectory\common.psm1 -Force -ArgumentList ($LogFileName) -ErrorAction Stop
$VMName = $null
$TestWorkingDirectory = $WorkingDirectory
}
Import-Module $WorkingDirectory\vm_run_tests.psm1 `

# Re-import common.psm1 in case Wait-TestJobToComplete's timeout handler
# forcefully re-imported it (via vm_run_tests.psm1), removing it from this scope.
Import-Module $WorkingDirectory\common.psm1 -Force -ArgumentList ($LogFileName) -ErrorAction SilentlyContinue
Comment on lines +299 to +300
Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue
Import-Module $WorkingDirectory\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue
# Start the VMs.
Start-AllVMs -VMList $VMList

if (-not $VMIsRemote) {
{
param([parameter(Mandatory=$true)][string] $VMName)

Write-Log "Unnstalling eBPF components on $VMName"
Copilot AI review requested due to automatic review settings August 26, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Suppressed comments (6)

Previously missed (5) — in code that hasn't changed since the last review.

scripts/execute_ebpf_cicd_tests.ps1:66

  • When ExecuteOnVM is true, $Config.VMMap.$SelfHostedRunnerName can be $null (missing key) or empty; indexing $VMList[0] will throw with a non-obvious error. Add an explicit validation and error message before using the first VM.
    if ($ExecuteOnVM) {
        Write-Log "Tests will be executed on VM" -ForegroundColor Cyan
        $VMList = $Config.VMMap.$SelfHostedRunnerName
        $VMName = $VMList[0].Name
        $TestWorkingDirectory = "C:\ebpf"

scripts/setup_ebpf_cicd_tests.ps1:82

  • When ExecuteOnVM is true, $Config.VMMap.$SelfHostedRunnerName can be missing/empty; later VM initialization and export steps will fail with unclear errors. Validate VMList early and throw a clear message.
    if  ($ExecuteOnVM) {
        $VMList = $Config.VMMap.$SelfHostedRunnerName
        if (-not $VMIsRemote) {
            # Get all local VMs to ready state.
            Initialize-AllVMs -VMList $VMList -ErrorAction Stop

scripts/cleanup_ebpf_cicd_tests.ps1:44

  • When ExecuteOnVM is true, $Config.VMMap.$SelfHostedRunnerName can be missing/empty; subsequent cleanup steps will fail and may obscure the real root cause. Validate VMList before using it.
    if ($ExecuteOnVM) {
        $VMList = $Config.VMMap.$SelfHostedRunnerName
        # Wait for all VMs to be in ready state, in case the test run caused any VM to crash.
        Wait-AllVMsToInitialize -VMList $VMList -VMIsRemote $VMIsRemote

.github/workflows/reusable-test.yml:105

  • This reusable workflow is triggered via workflow_call, so github.event.workflow_run.head_branch is not defined. Using it for actions/checkout can result in checking out the wrong ref or failing to resolve the ref; use github.sha (or github.ref) to ensure the workflow checks out the exact commit being tested.
    - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1  # v7.0.1
      # Check out source code if code coverage is being gathered or if crash dumps
      # (which require ProcDump downloaded via the repo scripts) are being gathered.
      if: ((inputs.code_coverage == true) || (inputs.gather_dumps == true)) && !contains(inputs.environment, '1ES') && (steps.skip_check.outputs.should_skip != 'true')
      with:

scripts/common.psm1:563

  • $JobTimedOut is only assigned in the timeout path; when the job completes normally this returns $null, which is easy to mis-handle and makes the return type inconsistent. Initialize it to $false before the loop.
    $TimeElapsed = 0

scripts/config_test_vm.psm1:314

  • Typo in log message: "Unnstalling" -> "Uninstalling".
    Write-Log "Unnstalling eBPF components on $VMName"

Comment thread scripts/vm_run_tests.psm1
Comment on lines +4 to +20
param(
[Parameter(Mandatory = $false)][bool] $ExecuteOnHost = $false,
[Parameter(Mandatory = $false)][bool] $ExecuteOnVM = $false,
[Parameter(Mandatory = $false)][bool] $VMIsRemote = $false,
[Parameter(Mandatory = $true)][string] $VMName,
[Parameter(Mandatory = $true)][string] $WorkingDirectory,
[Parameter(Mandatory = $true)][string] $LogFileName,
[Parameter(Mandatory = $false)][string] $TestMode = "CI/CD",
[Parameter(Mandatory = $false)][string[]] $Options = @("None"),
[Parameter(Mandatory = $false)][int] $TestHangTimeout = (30 * 60),
[Parameter(Mandatory = $false)][string] $UserModeDumpFolder = "C:\Dumps",
[Parameter(Mandatory = $false)][bool] $GranularTracing = $false,
[Parameter(Mandatory = $false)][bool] $RunXdpTests = $false
)

Import-Module "$PSScriptRoot\common.psm1" -Force -ArgumentList $LogFileName -WarningAction SilentlyContinue

Copilot AI review requested due to automatic review settings August 28, 2026 16:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/run_driver_tests.psm1:45

  • On timeout, the test process is left running. That can leak resources and interfere with subsequent tests / cleanup. The script should terminate the hung process before throwing the TimeoutException.
    if (-not $process.WaitForExit($Timeout * 1000)) {
        Write-Log "$Name exceeded its timeout. A kernel dump will be requested."
        throw [System.TimeoutException]::new("$Name timed out after $Timeout seconds.")
    }

scripts/config_test_vm.psm1:178

  • Initialize-AllVMs references $VMIsRemote, but that variable is not defined in module scope and isn’t passed as a parameter. This will always evaluate as $false (or rely on a global variable), which makes the remote-path logic unreliable and easy to break if the function is reused.
    if (-not $VMIsRemote) {
        # Wait for VMs to be ready.
        Write-Log "Waiting for all the VMs to be in ready state..." -ForegroundColor Yellow
        Wait-AllVMsToInitialize -VMList $VMList
    } else {

scripts/config_test_vm.psm1:314

  • Typo in log message: "Unnstalling" → "Uninstalling".
    Write-Log "Unnstalling eBPF components on $VMName"

Comment thread scripts/common.psm1
Comment on lines +770 to +772
function Get-VMPassword {
return 'eBPF4W!n'
}
Copilot AI review requested due to automatic review settings August 28, 2026 21:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

scripts/config_test_vm.psm1:166

  • Initialize-AllVMs branches on $VMIsRemote, but $VMIsRemote is not defined/passed into the function. This makes the remote-vs-local behavior depend on an outer-scope variable (or default to $false), which can lead to incorrect behavior if the function is ever used for remote VMs.
function Initialize-AllVMs
{
    param ([Parameter(Mandatory=$True)] $VMList)

scripts/config_test_vm.psm1:314

  • Typo in log message: "Unnstalling" -> "Uninstalling".
    Write-Log "Unnstalling eBPF components on $VMName"

Comment thread scripts/vm_run_tests.psm1
Comment on lines +78 to +93
function Stop-eBPFComponents
{
param([Parameter(Mandatory = $false)][bool] $GranularTracing = $false)

$scriptBlock = {
param($WorkingDirectory, $LogFileName)
Import-Module "$WorkingDirectory\common.psm1" -Force -ArgumentList $LogFileName -WarningAction SilentlyContinue
Import-Module "$WorkingDirectory\install_ebpf.psm1" `
-Force `
-ArgumentList $WorkingDirectory, $LogFileName `
-WarningAction SilentlyContinue
Stop-eBPFServiceAndDrivers
}

Invoke-OnHostOrVM -ScriptBlock $scriptBlock -ArgumentList @($script:WorkingDirectory, $script:LogFileName)
}
Copilot AI review requested due to automatic review settings August 28, 2026 23:11
@lakshk98
Laksh (lakshk98) marked this pull request as draft August 28, 2026 23:12
@microsoft-github-policy-service

Copy link
Copy Markdown

Laksh (@lakshk98) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Suppressed comments (5)

Previously missed (3) — in code that hasn't changed since the last review.

scripts/vm_run_tests.psm1:93

  • Stop-eBPFComponents accepts a GranularTracing parameter but never forwards it into the remote script block, so callers toggling GranularTracing currently have no effect. Pass GranularTracing through and call Stop-eBPFServiceAndDrivers with it.
    param([Parameter(Mandatory = $false)][bool] $GranularTracing = $false)

    $scriptBlock = {
        param($WorkingDirectory, $LogFileName)
        Import-Module "$WorkingDirectory\common.psm1" -Force -ArgumentList $LogFileName -WarningAction SilentlyContinue

scripts/setup_ebpf_cicd_tests.ps1:115

  • The comment says installing eBPF components "requires psexec" and can’t run in a PowerShell job, but the code path calls Install-eBPFComponents (msiexec-based) inside the job. This comment is misleading and should be removed or corrected.
        # Install eBPF components on host, but skip anything that requires reboot.
        # Note that installing ebpf components requires psexec which does not run in a powershell job.
        Write-Log "Installing eBPF components on host"

.github/workflows/cicd.yml:115

  • The 1ES JobId string includes the matrix job-index twice ("${{ strategy.job-index }}" and the "{0}" placeholder). Since reusable-test.yml already injects strategy.job-index via format(..., strategy.job-index), this will produce duplicated suffixes like "...-0-0". Remove one of them (keep "{0}" for formatting).

This issue also appears on line 137 of the same file.

      environment: '["self-hosted", "1ES.Pool=ebpf-extensions-cicd-runner-pool", "1ES.ImageOverride=${{ matrix.image }}_v2", "JobId=netevent-driver-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ strategy.job-index }}-{0}"]'

.github/workflows/cicd.yml:137

  • The 1ES JobId string includes the matrix job-index twice ("${{ strategy.job-index }}" and the "{0}" placeholder). Since reusable-test.yml already injects strategy.job-index via format(..., strategy.job-index), this will produce duplicated suffixes like "...-0-0". Remove one of them (keep "{0}" for formatting).
      environment: '["self-hosted", "1ES.Pool=ebpf-extensions-cicd-runner-pool", "1ES.ImageOverride=${{ matrix.image }}_v2", "JobId=ntos-driver-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ strategy.job-index }}-{0}"]'

scripts/config_test_vm.psm1:314

  • Typo in log message: "Unnstalling" should be "Uninstalling".
    Write-Log "Unnstalling eBPF components on $VMName"

@lakshk98
Laksh (lakshk98) force-pushed the setup-es-runners branch 2 times, most recently from ec0f682 to 0fa9ce5 Compare August 31, 2026 19:32
@lakshk98
Laksh (lakshk98) force-pushed the setup-es-runners branch 2 times, most recently from 537b7b3 to 07d3be7 Compare September 1, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants