Skip to content

Commit b8b66a7

Browse files
authored
Ignore curl failures for no-network build scenario (#7781)
* #7778 - Ignore curl failures for no-network build scenario * #7776 - only do logging when -ci is defined
1 parent fe787bd commit b8b66a7

4 files changed

Lines changed: 11 additions & 6 deletions

File tree

eng/common/build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ function InitializeCustomToolset {
187187
}
188188

189189
function Build {
190-
TryLogClientIpAddress
190+
191+
if [[ "$ci" == true ]]; then
192+
TryLogClientIpAddress
193+
fi
191194
InitializeToolset
192195
InitializeCustomToolset
193196

eng/common/sdk-task.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ try {
8383
}
8484

8585
if ($restore) {
86-
Try-LogClientIpAddress
86+
if ($ci) {
87+
Try-LogClientIpAddress
88+
}
8789
Build 'Restore'
8890
}
8991

eng/common/tools.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
154154
return $global:_DotNetInstallDir
155155
}
156156

157-
# In case of network error, try to log the current IP for reference
158-
Try-LogClientIpAddress
159-
160157
# Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism
161158
$env:DOTNET_MULTILEVEL_LOOKUP=0
162159

@@ -166,6 +163,9 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) {
166163
# Disable telemetry on CI.
167164
if ($ci) {
168165
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
166+
167+
# In case of network error, try to log the current IP for reference
168+
Try-LogClientIpAddress
169169
}
170170

171171
# Source Build uses DotNetCoreSdkDir variable

eng/common/tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ function StopProcesses {
402402
function TryLogClientIpAddress () {
403403
echo 'Attempting to log this client''s IP for Azure Package feed telemetry purposes'
404404
if command -v curl > /dev/null; then
405-
curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: '
405+
curl -s 'http://co1.msedge.net/fdv2/diagnostics.aspx' | grep ' IP: ' || true
406406
fi
407407
}
408408

0 commit comments

Comments
 (0)