Add -NoBinaryLog switch to opt-out of binlog in CI#5421
Conversation
dougbu
left a comment
There was a problem hiding this comment.
CI failures are due to my first comment in this review. See https://dev.azure.com/dnceng/public/_build/results?buildId=632262&view=logs&j=1295a90a-32ad-54ea-34e1-74b5e62ea3f1&t=d52efd14-fca6-511e-26d3-b8cb177efb38&l=14
| # Binary log must be enabled on CI. | ||
| [bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci } | ||
|
|
||
| # Set to true to opt out of outputing binary log while running in CI |
There was a problem hiding this comment.
| # Set to true to opt out of outputing binary log while running in CI | |
| # Set to true to opt out of outputting binary log while running in CI |
| # Binary log must be enabled on CI. | ||
| binary_log=${binary_log:-$ci} | ||
|
|
||
| # Set to true to opt out of outputing binary log while running in CI |
There was a problem hiding this comment.
| # Set to true to opt out of outputing binary log while running in CI | |
| # Set to true to opt out of outputting binary log while running in CI |
| Write-Host "Advanced settings:" | ||
| Write-Host " -projects <value> Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" | ||
| Write-Host " -ci Set when running on CI server" | ||
| Write-Host " -noBinaryLog Don't output binary log (useful when running on CI server) (short: -nobl)" |
There was a problem hiding this comment.
I'd remove the (useful when running on CI server) since it makes it sound like not using the binlog in CI would be recommended, but we actually want them in CI in most cases.
|
I don't like this. I'd prefer commenting out the condition if it's needed as a temporary workaround until the OOM is fixed: |
# Workaround Arcade check which asserts BinaryLog is true on CI.
# We always use binlogs on CI, but we customize the name of the log file
$tmpBinaryLog = $BinaryLog
if ($CI) {
$BinaryLog = $true
}
|
I meant commenting it out in Arcade. |
How would that work without removing the |
The same default also exists in build.ps1: Lines 136 to 139 in a8ee27e |
|
(this makes me sad.....however...onward) Question: Am I reading this correctly that -NoBinaryLog is only relevant for -CI? If so, maybe change the flag to -NoCIBinaryLog or something? |
|
@wtgodbe could you try hacking your local Arcade bits to make the minimal eng/common/tools.ps1|sh change i.e. just remove the error❔ Leave our build.ps1|sh hack mostly in place but include (As a smaller detail, the block a bit later just redoes what tools.ps1|sh does when Note a change to configure-toolset.ps1 could override an explicit |
|
Also, I'm not asking for a minimal change or a hack. I'm only asking if the flag is relevant to CI only, then perhaps we should put 'ci' in the name for clarity. |
Understood but I thought @tmat was looking for the minimal change. I suggested it and the hack would only be a variant of something dotnet/aspnetcore already needs to do. Either way, I'm fine. |
| # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. | ||
| # Binary log must be enabled on CI. | ||
| binary_log=${binary_log:-$ci} | ||
| binary_log=${binary_log:-$ci && -n $no_ci_binary_log} |
There was a problem hiding this comment.
I'm not sure if this is the right syntax
|
This change makes sense to me. |
| [switch] $publish, | ||
| [switch] $clean, | ||
| [switch][Alias('bl')]$binaryLog, | ||
| [switch][Alias('nobl')]$noCIBinaryLog, |
There was a problem hiding this comment.
nit: maybe "excludeCiBinlog", "no ci binary log" is slightly confusing as to what it means.
dougbu
left a comment
There was a problem hiding this comment.
Please merge as soon as you're sure the tools.sh change is correct unless there are new objections.
| # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. | ||
| # Binary log must be enabled on CI. | ||
| binary_log=${binary_log:-$ci} | ||
| binary_log=${binary_log:-$ci && -n $exclude_ci_binary_log} |
There was a problem hiding this comment.
Did you find a way to test this @wtgodbe❔
If not, Arcade doesn't use --excludeCIBinlog or anything similar, you'll need to apply this change in dotnet/aspnetcore and use it in dotnet/aspnetcore (under WSL, on a Linux VM, or in your PR). A quick check would include --projects rc/Html/Abstractions/src/Microsoft.AspNetCore.Html.Abstractions.csproj on the build.sh command line.
There was a problem hiding this comment.
Just tested it, this didn't work - I couldn't figure out a way to get expressions working while setting default parameters, so I initialized the default above.
| Write-Host "Advanced settings:" | ||
| Write-Host " -projects <value> Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" | ||
| Write-Host " -ci Set when running on CI server" | ||
| Write-Host " -excludeCIBinlog Don't output binary log (short: -nobl)" |
There was a problem hiding this comment.
@chcosta do these descriptions need to line up perfectly❔ (I'm hoping this is a nit we can fix later.)
|
I don't want to delay unblocking people, but another nit is that the naming is still a bit inconsistent. Sometimes it's "binary log" and sometimes it's "binlog". I only mention it because if it's not inconsistent now, then it probably never will be as it may become a breaking change. @dougbu , things like descriptions can be easily fixed whenever. |
|
So, you could have already done this without adding another parameter by setting the default for |
As I mentioned before, the default can't be changed. Instead the final version can be overridden -- without any information about the |
|
To close on this discussion, let's leave this in for now but add a tracking issue to do a follow up later for possible clean up, or an improved approach. cc/ @dougbu |
Some repos may want to opt-out of creating a binlog while in CI. For example currently, the AspNetCore binlog is currently large enough that it's hitting an msbuild error causing the build to OOM occasionally: dotnet/aspnetcore#21478. This PR adds a
-NoBinaryLogswitch that can be passed along with-CIto opt out of producing a binlog. It's kind of an ugly solution, but I couldn't think of another one that wasn't breaking. Changing the behavior of-CIwould break repos that assumed passing-CIwould create a binlog, and changing-Blfrom a switch to a bool would break folks in a similar way. I'm open to suggestions, though.