-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Local live builds not picking up runtime config #2093
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
Conversation
The local live builds were not properly picking up the runtime configuration varaible. This meant that libraries always attempted to build against a Debug CoreCLR even if the developer specified `-runtimeConfiguration Release`
|
FYI @ManickaP |
|
Appears this behavior was broken by #1934 |
eng/liveBuilds.targets
Outdated
| <PropertyGroup> | ||
| <CoreCLROSGroup Condition="'$(CoreCLROSGroup)' == ''">$(OSGroup)</CoreCLROSGroup> | ||
| <CoreCLRConfiguration Condition="'$(CoreCLRConfiguration)' == ''">$(Configuration)</CoreCLRConfiguration> | ||
| <CoreCLRConfiguration Condition="'$(CoreCLRConfiguration)' == ''">$(RuntimeConfiguration)</CoreCLRConfiguration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if RuntimeConfiguration is not used? CoreCLRConfiguration would be empty in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the same should apply for MonoConfiguration, it should take RuntimeConfiguration as the configuration if it was passed globally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ... all that logic really needs to be hoisted up so both the live and CI builds share it. Let me do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if RuntimeConfiguration is not used? CoreCLRConfiguration would be empty in that case.
When will this be the case though? All of our build scripts explicitly pass /p:RuntimeConfiguration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I just do: build.cmd (wanting to build everything on debug), or build.cmd -c Release wanting to build all in Release. That will not pass down RuntimeConfiguration. That is actually why the runtime-live-build is failing in CI because, in those builds we don't use -runtimeConfiguration.
Which I mentioned offline, we should exercise that in that build, we should have a leg for combining the subset's configurations around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was what I was thinking as well. Still don' tthink it's complete though because same problem applies: what if $(Configuration) is empty?
Again this comes back to what are the defaults. We should fall back to them when the build doesn't specify them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configuration will never be empty, Configuration is always passed down by arcade, default is Debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the property group in Subsets.props has the same issue fi RuntimeConfiguration is unspecified. Overall it's unclear why we repeat this property group between Directory.Build.props and SubSets.props. Seems much simpler to move this property group above the imports of Subsets.props and avoid repeating this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the property group I'm referring to that should be moved https://github.com/dotnet/runtime/blob/master/Directory.Build.props#L55
- Ensure that `$(RuntimeConfiguration)` is always set - Remove duplicated logic in Subsets.props
eng/liveBuilds.targets
Outdated
| <CoreCLRConfiguration Condition="'$(CoreCLRConfiguration)' == ''">$(RuntimeConfiguration)</CoreCLRConfiguration> | ||
| <MonoOSGroup Condition="'$(MonoOSGroup)' == ''">$(OSGroup)</MonoOSGroup> | ||
| <MonoConfiguration Condition="'$(MonoConfiguration)' == ''">$(Configuration)</MonoConfiguration> | ||
| <MonoConfiguration Condition="'$(MonoConfiguration)' == ''">$(RuntimeConfiguration)</MonoConfiguration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think these sets of $(CoreCLRConfiguration) and $(MonoConfiguration) can be deleted entirely. These always flow from Directory.Build.props
Directory.Build.props
Outdated
| <!-- Honor the generic RuntimeConfiguration property. --> | ||
| <PropertyGroup> | ||
| <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">$(Configuration)</RuntimeConfiguration> | ||
| <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">Debug</RuntimeConfiguration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeConfiguration will not be empty here because $(Configuration) is always passed as Debug by default if it is not specified.
safern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is 2 other instances of CoreCLRConfiguration which are wrong and shouldn't be there in my opinion:
runtime/src/libraries/shims/manual/Directory.Build.props
Lines 16 to 19 in cd622cd
| <CoreCLROSGroup>$(_bc_OSGroup)</CoreCLROSGroup> | |
| <CoreCLRConfiguration>$(_bc_ConfigurationGroup)</CoreCLRConfiguration> | |
| <MonoOSGroup>$(_bc_OSGroup)</MonoOSGroup> | |
| <MonoConfiguration>$(_bc_ConfigurationGroup)</MonoConfiguration> |
runtime/src/libraries/Directory.Build.targets
Lines 3 to 6 in cd622cd
| <CoreCLROSGroup Condition="'$(CoreCLROSGroup)' == ''">$(_bc_OSGroup)</CoreCLROSGroup> | |
| <CoreCLRConfiguration Condition="'$(CoreCLRConfiguration)' == ''">$(_bc_ConfigurationGroup)</CoreCLRConfiguration> | |
| <MonoOSGroup Condition="'$(MonoCLROSGroup)' == ''">$(_bc_OSGroup)</MonoOSGroup> | |
| <MonoConfiguration Condition="'$(MonoConfiguration)' == ''">$(_bc_ConfigurationGroup)</MonoConfiguration> |
|
Yeah those locations seem to be dead code to. Going to delete them. |
Change the live / live jobs so they mix release and debug configurations. This will help ensure we avoid future breaks in this area
|
Interesting. Builds are all working locally just fine with this change and the build is succeeding in CI in that the debug and release are combining together. Yet somehow I've broken the loading of the Roslyn compiler. Lots of the following:
Generally that means we're attempting to load the Roslyn build task from two different locations during the build. Unsure how my changes could impact where Roslyn is loading from. Hoping I can reproduce this on my machine, or at least the binary log will give me more insight into where we do the different loads so I can track it down. There is no explicit |
safern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing!
|
Got the live / live build job to upload the binary log from the failures here and that's helping narrowing down the problem a bit. What is apparently happening here is there are multiple invocations of The standard build is using the package specified in
This error indicates MSBuild is loading the C# targets from the Looking at some other builds I can see the non-custom version being loaded here
Trying to locate these other invocations of Still quite unsure how my changes could cause this node re-use problem though. 😦 |
|
@janvorli - haven't you been recently looking into a similar issue? The last time I saw this fail was during test build because the Common folder wasn't excluded from the wrapper folder list but I believe that has been fixed already. |
|
Yes, this has been broken for me locally since December for build.cmd / build-test.cmd . It happens because some phases of the build pick the Microsoft.Build.Tasks.CodeAnalysis.dll from the .dotnet subfolder of the repo and some from a nuget package installed on my machine. AFAIK @ViktorHofer's pending change #901 is supposed to ultimately fix that. |
|
|
||
| # Build | ||
| - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -c ${{ parameters.buildConfig }} -runtimeConfiguration ${{ parameters.runtimeConfig }} -arch ${{ parameters.archType }} | ||
| - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -c ${{ parameters.buildConfig }} -runtimeConfiguration ${{ parameters.runtimeConfig }} -arch ${{ parameters.archType }} -bl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would instead recommend using the -ci flag which does extra logging, clean-up, makes sure the dotnet we acquired is on the path and isolate the nuget cache, plus, it generates binlogs.
| - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -c ${{ parameters.buildConfig }} -runtimeConfiguration ${{ parameters.runtimeConfig }} -arch ${{ parameters.archType }} -bl -ci | ||
| displayName: Build product | ||
|
|
||
| - task: PublishBuildArtifacts@1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having to add this step, you can just pass down a parameter to the template we use which is job.yml from arcade. That parameter is enablePublishBuildArtifacts: true.
https://github.com/dotnet/arcade/blob/master/eng/common/templates/job/job.yml#L180
Note that you also need to declare a variable _BuildConfig: ${{ parameters.buildConfig }} because it uses it to find the logs:
https://github.com/dotnet/arcade/blob/master/eng/common/templates/job/job.yml#L184
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job though deliberately builds multiple configurations though hence seems like it can't directly hook up to that infrastructure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can hook up to that infrastructure, the binlog will be created under the global buildConfig which is passed through the -configuration argument. The binlog name and location is calculated on the build script in arcade, which doesn't know about runtimeConfiguration. However if you want to produce binlogs for other steps in the coreclr build scripts, then we will definitely not be able to use this.
| <!-- Honor the generic RuntimeConfiguration property. --> | ||
| <PropertyGroup> | ||
| <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">$(ConfigurationGroup)</RuntimeConfiguration> | ||
| <RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">$(Configuration)</RuntimeConfiguration> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary as ConfigurationGroup and Configuration are always passed in together. In future we will probably remove the former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily. If you build the projects directly then ConfigurationGroup is not specified.
Also looking through the logs @jkoritzinsky and I observed places where $(ConfigurationGroup) was not set but $(Configuration) was. This change was inspired by that observation. It's deep in the restore graph where we encountered this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concrete example where only $(Configuration) is passed to the build
|
@jkoritzinsky @rainersigwald and I finally got to the bottom of why restore started failing in the face of my change. It really comes down to the following block of code (as existed before my PR): <ItemDefinitionGroup Condition="'$(CoreCLRConfiguration)' != ''">
<CoreClrProjectToBuild>
<Properties>Configuration=$(CoreCLRConfiguration)</Properties>
</CoreClrProjectToBuild>
</ItemDefinitionGroup>The problem my PR is addressing is that My PR though enforced that <Properties>Configuration=$(CoreCLRConfiguration)</Properties>This does not add the value The correct way to do this is to use <ItemDefinitionGroup Condition="'$(CoreCLRConfiguration)' != ''">
<CoreClrProjectToBuild>
<AdditionalProperties>Configuration=$(CoreCLRConfiguration)</AdditionalProperties>
</CoreClrProjectToBuild>
</ItemDefinitionGroup> |
|
Oh wow... that was an interesting one. Thanks for the detailed explanation. |
safern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for all the hard work to getting this properly fixed
|
Merging since test failures are known failures. |
The local live builds were not properly picking up the runtime
configuration varaible. This meant that libraries always attempted to
build against a Debug CoreCLR even if the developer specified
-runtimeConfiguration Release