Skip to content

feat: Add windows support and cli changes #1682

feat: Add windows support and cli changes

feat: Add windows support and cli changes #1682

name: Build E2E Test Event Writer
on:
workflow_call:
pull_request:
push:
branches:
- main
- "dev/**"
workflow_dispatch:
permissions:
contents: read
id-token: write
packages: write
env:
EVENT_WRITER_PATH: "${{ github.workspace }}/test/e2e/tools/event-writer/"
EBPF_VERSION: "1.1.0"
XDP_SDK_VERSION: "1.3.0"
jobs:
retina-win-e2e-bpf-images:
name: Build E2E Test Event Writer
runs-on: windows-2022
env:
PUBLISH_TO_ACR: ${{ github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch' }}
strategy:
matrix:
platform: ["windows"]
arch: ["amd64"]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Azure Login
uses: azure/login@f5d393ae46f8fde4be8b75f32e3fc50e654ad0ca # v3.0.1
if: ${{ env.PUBLISH_TO_ACR == 'true' }}
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Ensure Docker daemon is running
shell: pwsh
run: |
$timeout = 120
$timer = [Diagnostics.Stopwatch]::StartNew()
while ($timer.Elapsed.TotalSeconds -lt $timeout) {
$svc = Get-Service docker -ErrorAction SilentlyContinue
if ($svc -and $svc.Status -ne 'Running') {
Start-Service docker -ErrorAction SilentlyContinue
}
$result = docker info 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Host "Docker daemon is ready"
return
}
Write-Host "Waiting for Docker daemon to start..."
Start-Sleep -Seconds 5
}
throw "Docker daemon failed to start within $timeout seconds"
- name: Docker Login to ACR
if: ${{ env.PUBLISH_TO_ACR == 'true' }}
shell: pwsh
run: az acr login --name "${{ vars.ACR_NAME }}"
- name: Docker Login to ghcr.io
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
if: ${{ env.PUBLISH_TO_ACR != 'true' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set MSBuild path
run: |
echo "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install LLVM 18.1.8
shell: pwsh
run: |
# Install LLVM 18.1.8 to ensure consistent version across runners
try {
choco install llvm --version=18.1.8 --allow-downgrade -y --force
# Add installed LLVM to PATH first so it takes precedence
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Host "Successfully installed LLVM 18.1.8"
} catch {
Write-Warning "Failed to install LLVM 18.1.8 via chocolatey: $($_.Exception.Message)"
Write-Host "Continuing with pre-installed LLVM version"
}
- name: Nuget Restore
shell: cmd
run: |
nuget restore .\event_writer.sln
working-directory: ${{ env.EVENT_WRITER_PATH }}
- name: Configure eBPF store
shell: cmd
run: |
.\export_program_info.exe --clear
.\export_program_info.exe
working-directory: ${{ env.EVENT_WRITER_PATH }}\packages\eBPF-for-Windows.x64.${{ env.EBPF_VERSION }}\build\native\bin
- name: Build Event-Writer
shell: cmd
run: |
msbuild /m /t:Clean /p:Configuration=Release /p:Platform=x64 /restore event_writer.sln
msbuild /m /p:Configuration=Release /p:Platform=x64 /restore /v:detailed event_writer.sln
working-directory: ${{ env.EVENT_WRITER_PATH }}
- name: Determine Docker tag
id: tag
shell: pwsh
run: |
$TAG = $(git tag --points-at HEAD)
if (-not $TAG) {
$TAG = $(git rev-parse --short HEAD)
}
echo "tag=$TAG" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Build and push images
shell: pwsh
working-directory: ${{ env.EVENT_WRITER_PATH }}
run: |
$publishToAcr = "${{ env.PUBLISH_TO_ACR }}" -eq "true"
if (-not $publishToAcr) {
$image = "ghcr.io/${{ github.repository }}/test/e2e-test-event-writer".ToLower()
} else {
$image = "${{ vars.ACR_NAME }}/${{ github.repository }}/test/e2e-test-event-writer".ToLower()
}
$tag = "${{ steps.tag.outputs.tag }}"
docker build -f "./Dockerfile" -t "${image}:${tag}" -t "${image}:latest" .
if ("${{ github.event_name }}" -ne "pull_request") {
docker push "${image}:${tag}"
docker push "${image}:latest"
} else {
Write-Host "Skipping image push for pull_request runs"
}