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

DO NOT MERGE: Using Azure Edge diagnostic endpoint to log reported IP #57595

Closed
Closed
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
2 changes: 1 addition & 1 deletion eng/common/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ try {
if ($restore) {
InitializeNativeTools
}

Try-LogClientIpAddress
Build
}
catch {
Expand Down
1 change: 1 addition & 0 deletions eng/common/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function InitializeCustomToolset {
}

function Build {
LogClientIp
InitializeToolset
InitializeCustomToolset

Expand Down
1 change: 1 addition & 0 deletions eng/common/sdk-task.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ try {
}

if ($restore) {
Try-LogClientIpAddress
Build 'Restore'
}

Expand Down
18 changes: 18 additions & 0 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -872,3 +872,21 @@ 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" -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
{
Write-Host "Unable to get this machine's effective IP address for logging: $_"
}
}
8 changes: 8 additions & 0 deletions eng/common/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down