From af0ec8adfa728862b185fc89a79e76e4303c6ec4 Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Tue, 17 Aug 2021 10:20:13 -0700 Subject: [PATCH 1/3] DO NOT MERGE: Using Azure Edge diagnostic endpoint to log reported IP addresses, needed for Azure Front Door investigation of package feed 'hangups' --- eng/common/build.ps1 | 2 +- eng/common/build.sh | 1 + eng/common/sdk-task.ps1 | 1 + eng/common/tools.ps1 | 16 ++++++++++++++++ eng/common/tools.sh | 8 ++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 8943da242f6e9..b3224ea4a65a0 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -149,7 +149,7 @@ try { if ($restore) { InitializeNativeTools } - + Try-LogClientIpAddress Build } catch { diff --git a/eng/common/build.sh b/eng/common/build.sh index 55b298f16ccd1..91e845d4914eb 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -187,6 +187,7 @@ function InitializeCustomToolset { } function Build { + LogClientIp InitializeToolset InitializeCustomToolset diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index b1bca63ab1d82..7ffa3591e9ca0 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -83,6 +83,7 @@ try { } if ($restore) { + Try-LogClientIpAddress Build 'Restore' } diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 5d526c74d518c..82f36578b9010 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -872,3 +872,19 @@ if (!$disableConfigureToolsetImport) { } } } + +function Try-LogClientIpAddress() +{ + Write-Host "Attempting to log this client's IP for Azure Package feed telemetry purposes" + try + { + $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" + $lines = $result.Content.Split([Environment]::NewLine) + Write-Host $lines | Select-String -Pattern "^Socket IP:.*" + Write-Host $lines | Select-String -Pattern "^Client IP:.*" + } + catch + { + Write-Host "Unable to get this machine's effective IP address for logging" + } +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 828119be411b3..ce2225ff7019e 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -399,6 +399,14 @@ function StopProcesses { return 0 } +function LogClientIp () { + echo 'Attempting to log this client''s IP for Azure Package feed telemetry purposes' + echo + if command -v curl > /dev/null; then + curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' + fi +} + function MSBuild { local args=$@ if [[ "$pipelines_log" == true ]]; then From ad381de24b0006813b5a65639b33dfa54d0b9e0d Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Tue, 17 Aug 2021 12:21:05 -0700 Subject: [PATCH 2/3] Just log the whole content block (having problems on agent) --- eng/common/tools.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 82f36578b9010..a8e9b2e155780 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -879,12 +879,11 @@ function Try-LogClientIpAddress() try { $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" - $lines = $result.Content.Split([Environment]::NewLine) - Write-Host $lines | Select-String -Pattern "^Socket IP:.*" - Write-Host $lines | Select-String -Pattern "^Client IP:.*" + Write-Host $result.Content } catch { - Write-Host "Unable to get this machine's effective IP address for logging" + $errMessage = $_ + Write-Host "Unable to get this machine's effective IP address for logging: ($errMessage)" } } From c2cd66deb9251379aeb433498e42a53ebaf648e0 Mon Sep 17 00:00:00 2001 From: Matt Galbraith Date: Tue, 17 Aug 2021 13:17:12 -0700 Subject: [PATCH 3/3] Figured out previous issue (UseBasicParsing) --- eng/common/tools.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index a8e9b2e155780..6d841b132b2e3 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -878,12 +878,15 @@ function Try-LogClientIpAddress() Write-Host "Attempting to log this client's IP for Azure Package feed telemetry purposes" try { - $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" - Write-Host $result.Content + $result = Invoke-WebRequest -Uri "http://co1.msedge.net/fdv2/diagnostics.aspx" -UseBasicParsing + $lines = $result.Content.Split([Environment]::NewLine) + $socketIp = $lines | Select-String -Pattern "^Socket IP:.*" + Write-Host $socketIp + $clientIp = $lines | Select-String -Pattern "^Client IP:.*" + Write-Host $clientIp } catch { - $errMessage = $_ - Write-Host "Unable to get this machine's effective IP address for logging: ($errMessage)" + Write-Host "Unable to get this machine's effective IP address for logging: $_" } }