Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ daddr
datacenter
davidanson
DDCE
DDTHH
debbuild
DEBHELPER
debian
Expand Down Expand Up @@ -145,6 +146,8 @@ INVM
Ioctl
iusr
jetbrains
jqlang
JOBOBJECT
jobsjob
joutvhu
JScript
Expand Down Expand Up @@ -175,6 +178,7 @@ MFC
microsoftcblmariner
microsoftlosangeles
microsoftwindowsdesktop
mmm
mnt
msasn
msp
Expand Down Expand Up @@ -270,6 +274,7 @@ spellright
splitn
SRPMS
SSRF
SSZ
stackoverflow
stdbool
stdint
Expand Down Expand Up @@ -320,10 +325,12 @@ vflji
vhd
vmagentlog
VMGA
vmhwm
VMId
vmlinux
vmr
vmrcs
vmrss
vms
vns
VTeam
Expand Down Expand Up @@ -351,6 +358,7 @@ wireserverand
wireserverandimds
WMI
workarounds
WORKINGSET
WORKDIR
WScript
wsf
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: rust-toolchain
uses: actions-rs/[email protected]
with:
toolchain: 1.69.0
toolchain: stable

- name: Install llvm Code Coverage
uses: taiki-e/install-action@cargo-llvm-cov
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
- name: rust-toolchain
uses: actions-rs/[email protected]
with:
toolchain: 1.69.0
toolchain: stable

- name: Run Build.cmd Debug arm64
run: .\build.cmd debug arm64
Expand Down
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ echo "======= BuildEnvironment is $BuildEnvironment"


echo "======= rustup update to a particular version"
rustup_version=1.88.0
rustup_version=1.92.0
rustup update $rustup_version

# This command sets a specific Rust toolchain version for the current directory.
Expand Down
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if "%Target%"=="arm64" (
)

echo ======= rustup update to a particular version of the Rust toolchain
SET rustup_version=1.88.0
SET rustup_version=1.92.0
call rustup update %rustup_version%
REM This command sets a specific Rust toolchain version for the current directory.
REM It means that whenever you are in this directory, Rust commands will use the specified toolchain version, regardless of the global default.
Expand Down
5 changes: 3 additions & 2 deletions e2etest/GuestProxyAgentTest/GuestProxyAgentTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
private preview feed for Azure SDK for .NET packages
https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
</RestoreAdditionalProjectSources> -->
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.4" />
<PackageReference Include="Azure.ResourceManager" Version="1.13.0" />
<PackageReference Include="Azure.ResourceManager.Compute" Version="1.9" />
<PackageReference Include="Azure.ResourceManager" Version="1.13.2" />
<PackageReference Include="Azure.ResourceManager.Compute" Version="1.13.0" />
<PackageReference Include="Azure.ResourceManager.Network" Version="1.9" />
<PackageReference Include="Azure.ResourceManager.Resources" Version="1.9" />
<PackageReference Include="Azure.ResourceManager.Storage" Version="1.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
# SPDX-License-Identifier: MIT

customOutputJsonUrl=$(echo $customOutputJsonSAS | base64 -d)
expectedSecureChannelState=$(echo $expectedSecureChannelState)

echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - Start Guest Proxy Agent Validation"
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - expectedSecureChannelState=$expectedSecureChannelState"

currentDir=$(pwd)
customOutputJsonPath=$currentDir/proxyagentvalidation.json

Expand Down Expand Up @@ -47,12 +50,104 @@ else
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - logdir does not exist"
fi

echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - detecting os and installing jq"
os=$(hostnamectl | grep "Operating System")
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - os=$os"
if [[ $os == *"Ubuntu"* ]]; then
for i in {1..3}; do
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - start installing jq via apt-get $i"
sudo apt update
sudo apt-get install -y jq
sleep 10
install=$(apt list --installed jq)
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - install=$install"
if [[ $install == *"jq"* ]]; then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - jq installed successfully"
break
fi
done
elif [[ $os == *"SUSE"* ]]; then
# SUSE repo does not have jq package, so we download jq binary directly
# Detect architecture
arch=$(uname -m)
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - detected architecture: $arch"
if [[ $arch == "x86_64" ]]; then
jq_binary="jq-linux-amd64"
elif [[ $arch == "aarch64" ]] || [[ $arch == "arm64" ]]; then
jq_binary="jq-linux-arm64"
else
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - unsupported architecture: $arch"
jq_binary="jq-linux64"
fi
# Download jq binary directly from GitHub
for i in {1..3}; do
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - downloading $jq_binary binary (attempt $i)"
sudo curl -L https://github.com/jqlang/jq/releases/download/jq-1.8.1/$jq_binary -o /usr/local/bin/jq
if [ $? -eq 0 ]; then
sudo chmod +x /usr/local/bin/jq
if command -v jq &> /dev/null; then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - jq installed successfully"
jq --version
break
fi
fi
sleep 5
done
else
for i in {1..3}; do
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - start installing jq via dnf $i"
sudo dnf -y install jq
sleep 10
install=$(dnf list --installed jq)
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - install=$install"
if [[ $install == *"jq"* ]]; then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - jq installed successfully"
break
fi
done
fi

# check status.json file Content
## check timestamp of last entry in status.json file
## check the secure channel status
timeout=300
elapsed=0
statusFile=$logdir/status.json
secureChannelState=""

# Current UTC time in epoch seconds
currentUtcTime=$(date -u +%s)
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - Checking GPA status file $statusFile with 5 minute timeout"
while :; do
timestamp=$(cat "$statusFile" | jq -r '.timestamp')
# Convert timestamp to epoch seconds
timestampEpoch=$(date -u -d "$timestamp" +%s)
if ((timestampEpoch > currentUtcTime)); then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - The last entry timestamp '$timestamp' is valid."
## check secure channel status
secureChannelState=$(cat "$statusFile" | jq -r '.proxyAgentStatus.keyLatchStatus.states.secureChannelState')
if [[ "$secureChannelState" == "$expectedSecureChannelState" ]]; then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - The secure channel status '$secureChannelState' matches the expected state: '$expectedSecureChannelState'."
break
else
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - The secure channel status '$secureChannelState' does not match the expected state: '$expectedSecureChannelState'."
fi
fi
((elapsed += 3))
if [[ $elapsed -ge $timeout ]]; then
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - Timeout reached. Error, The secureChannelState is '$secureChannelState'."
break
fi
sleep 3
done

echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - guestProxyAgentServiceExist=$guestProxyAgentServiceExist"
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - guestProxyAgentServiceStatus=$guestProxyAgentServiceStatus"
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - guestProxyProcessStarted=$guestProxyProcessStarted"
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - guestProxyAgentLogGenerated=$guestProxyAgentLogGenerated"
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - secureChannelState=$secureChannelState"

jsonString='{"guestProxyAgentServiceInstalled": "'$guestProxyAgentServiceExist'", "guestProxyAgentServiceStatus": "'$guestProxyAgentServiceStatus'", "guestProxyProcessStarted": "'$guestProxyProcessStarted'", "guestProxyAgentLogGenerated": "'$guestProxyAgentLogGenerated'"}'
jsonString='{"guestProxyAgentServiceInstalled": "'$guestProxyAgentServiceExist'", "guestProxyAgentServiceStatus": "'$guestProxyAgentServiceStatus'", "guestProxyProcessStarted": "'$guestProxyProcessStarted'", "secureChannelState": "'$secureChannelState'", "guestProxyAgentLogGenerated": "'$guestProxyAgentLogGenerated'"}'
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") - $jsonString"

# write to $customOutputJsonPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

param (
[Parameter(Mandatory=$true, Position=0)]
[string]$customOutputJsonSAS,
[string]$customOutputJsonSAS,
[string]$expectedProxyAgentVersion
)
Write-Output "$((Get-Date).ToUniversalTime()) - expectedProxyAgentVersion=$expectedProxyAgentVersion"
Expand Down
50 changes: 47 additions & 3 deletions e2etest/GuestProxyAgentTest/Scripts/GuestProxyAgentValidation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

param (
[Parameter(Mandatory=$true, Position=0)]
[string]$customOutputJsonSAS
[string]$customOutputJsonSAS,
[string]$expectedSecureChannelState
)

$decodedUrlBytes = [System.Convert]::FromBase64String($customOutputJsonSAS)
$decodedUrlString = [System.Text.Encoding]::UTF8.GetString($decodedUrlBytes)

Write-Output "$((Get-Date).ToUniversalTime()) - Start Guest Proxy Agent Validation"
Write-Output "$((Get-Date).ToUniversalTime()) - expectedSecureChannelState=$expectedSecureChannelState"

$currentFolder = $PWD.Path
$customOutputJsonPath = $currentFolder + "\proxyagentvalidation.json";
Expand All @@ -21,7 +23,7 @@ $guestProxyAgentServiceExist = $true
$guestProxyAgentServiceStatus = ""
$guestProxyAgentProcessExist = $true

if ($service -ne $null) {
if ($null -ne $service) {
Write-Output "$((Get-Date).ToUniversalTime()) - The service $serviceName exists."
$guestProxyAgentServiceStatus = $service.Status
} else {
Expand All @@ -34,7 +36,7 @@ $processName = "GuestProxyAgent"

$process = Get-Process -Name $processName -ErrorAction SilentlyContinue

if ($process -ne $null) {
if ($null -ne $process) {
Write-Output "$((Get-Date).ToUniversalTime()) - The process $processName exists."
} else {
$guestProxyAgentProcessExist = $false
Expand All @@ -57,10 +59,52 @@ if (Test-Path -Path $folderPath -PathType Container) {
Write-Output "$((Get-Date).ToUniversalTime()) - The folder $folderPath does not exist."
}

# check status.json file Content
## check timestamp of last entry in status.json file
## check the secure channel status
$timeoutInSeconds = 300
$statusFilePath = [IO.Path]::Combine($folderPath, "status.json")
Write-Output "$((Get-Date).ToUniversalTime()) - Checking GPA status file $statusFilePath with 5 minute timeout"
$secureChannelState = ""
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
$currentUtcTime = (Get-Date).ToUniversalTime()
do {
$boolStatus = Test-Path -Path $statusFilePath
if ($boolStatus) {
$json = Get-Content $statusFilePath | Out-String | ConvertFrom-Json
$timestamp = $json.timestamp
if ($null -ne $timestamp -and $timestamp -ne "") {
Write-Output "$((Get-Date).ToUniversalTime()) - The status.json file contains a valid timestamp: $timestamp"
# parse the timestamp to UTC DateTime object, if must later than $currentUtcTime
$timestampDateTime = [DateTime]::Parse($timestamp).ToUniversalTime()
if ($timestampDateTime -gt $currentUtcTime) {
Write-Output "$((Get-Date).ToUniversalTime()) - The status.json timestamp $timestampDateTime is later than $currentUtcTime."
## check secure channel status
$secureChannelState = $json.proxyAgentStatus.keyLatchStatus.states.secureChannelState
Write-Output "$((Get-Date).ToUniversalTime()) - The secure channel status is $secureChannelState."
if ($secureChannelState -eq $expectedSecureChannelState) {
Write-Output "$((Get-Date).ToUniversalTime()) - The secure channel status '$secureChannelState' matches the expected state: '$expectedSecureChannelState'."
# break
} else {
Write-Output "$((Get-Date).ToUniversalTime()) - The secure channel status '$secureChannelState' does not match the expected state: '$expectedSecureChannelState'."
}

if ($stopwatch.Elapsed.TotalSeconds -ge $timeoutInSeconds) {
Write-Output "$((Get-Date).ToUniversalTime()) - Timeout reached. Error, The secureChannelState is '$secureChannelState'."
break
}
}
} else {
Write-Output "$((Get-Date).ToUniversalTime()) - The status.json file does not contain a valid timestamp yet."
}
}
start-sleep -Seconds 3
} until ($false)

$jsonString = '{"guestProxyAgentServiceInstalled": ' + $guestProxyAgentServiceExist.ToString().ToLower() `
+ ', "guestProxyProcessStarted": ' + $guestProxyAgentProcessExist.ToString().ToLower() `
+ ', "guestProxyAgentServiceStatus": "' + $guestProxyAgentServiceStatus `
+ '", "secureChannelState": "' + $secureChannelState `
+ '", "guestProxyAgentLogGenerated": ' + $guestProxyAgentLogGenerated.ToString().ToLower() + '}'

Write-Output "$((Get-Date).ToUniversalTime()) - $jsonString"
Expand Down
3 changes: 0 additions & 3 deletions e2etest/GuestProxyAgentTest/Settings/TestSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
using Azure.Core;
using GuestProxyAgentTest.Models;
using GuestProxyAgentTest.Utilities;
using Newtonsoft.Json;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.Json.Serialization;

namespace GuestProxyAgentTest.Settings
{
Expand Down
Loading
Loading