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

Microsoft.AspNetCore.App.Ref needs to be produced and versioned correctly in servicing for source-build #39471

Closed
MichaelSimons opened this issue Jan 13, 2022 · 45 comments
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Comments

@MichaelSimons
Copy link
Member

Currently building release/6.0 for 6.0.1 doesn't produce a Microsoft.AspNetCore.App.Ref package. This is because the package wasn't serviced in 6.0.1. 6.0.0 is the active version yet the build doesn't produce it. This breaks source-build which needs to produce the entire product.

In previous versions, source-build handled this by treating the package as a reference package via https://github.com/dotnet/source-build-reference-packages. This is no longer an option in 6.0 with the introduction of roslyn analyzers (e.g source) in the package.

dotnet/runtime made changes in 6.0 to support this here.

@MichaelSimons
Copy link
Member Author

cc @dougbu, @wtgodbe

@MichaelSimons
Copy link
Member Author

@wtgodbe - I see this is in Next sprint can you give a rough idea of when we could expect a fix? I ask as this is currently a blocker for source-build.

@wtgodbe
Copy link
Member

wtgodbe commented Jan 13, 2022

We're going to discuss it at standup today. It looks like the change is needed in 6.0, which means the earliest we could do it is likely 6.0.3 (March patch) as the February builds are already underway. Is it also needed in main? We can do it ASAP if there's an additional time constraint beyond the 6.0 releases

@MichaelSimons
Copy link
Member Author

Yes a change is needed in 6.0 and it should be backported to main. We need a fix for 6.0.2 but if you have a fix, we can create a source-build patch for 6.0.2.

@wtgodbe
Copy link
Member

wtgodbe commented Jan 13, 2022

@MichaelSimons we're actually servicing the ref pack again in 6.0.2, with version 6.0.2 - will that unblock source build? If so we can have the patch ready for 6.0.3 so that it continues producing the 6.0.2 targeting pack for source build. If not we'll get a fix ASAP and see if we can merge it for 6.0.2

@MichaelSimons
Copy link
Member Author

@wtgodbe - That will work for 6.0.2 but source-built Fedora 6.0.1 was unable to release because of this issue. It would be most helpful if you could provide a fix that we could apply as a source-build patch to unblock.

@dougbu
Copy link
Member

dougbu commented Jan 13, 2022

We're confused by this issue @MichaelSimons. The runtime code just sets a property for the previous version of the targeting pack. Does something else rebuild the targeting pack w/ that version in every servicing build (when doing a source build)❔

In any case, we already have a property w/ the version of the last targeting pack -- $(TargetingPackVersionPrefix). Our preference is to rebuild the targeting pack only when the contained ref/ assemblies or source generators require a fix. But, we could either always release a targeting pack everywhere or switch between shipping it (giving it a stable package version) or not for servicing releases. Today, the targeting pack (though not the installers) packing is turned on or off and the App.Ref project always builds.

It would be confusing to look at a build of 6.0.2 and see a 6.0.0 or 6.0.1 targeting pack. I also worry doing that would mess up the release. Is this exclusively about source-builds❔

I guess the general question is why Fedora and so on need a targeting pack every time. I thought their requirement was strictly runtime components❔

@MichaelSimons
Copy link
Member Author

Does something else rebuild the targeting pack w/ that version in every servicing build (when doing a source build)❔

Yes - When building source-build this prevents SkipBuild from getting set.

Our preference is to rebuild the targeting pack only when the contained ref/ assemblies or source generators require a fix.

This does not work for source-build because it needs to build the full product. Pre-6.0 source-build was able to handle the targeting packs not getting built during servicing by treating them as ref packs (e.g. adding them to https://github.com/dotnet/source-build-reference-packages). With the introduction of the analyzers, this is no longer an option. I have no objection to your proposal to always release a targeting pack. It feels like this behavior is something that would ideally be the same between the runtime and aspnetcore.

cc @safern ^

It would be confusing to look at a build of 6.0.2 and see a 6.0.0 or 6.0.1 targeting pack. I also worry doing that would mess up the release. Is this exclusively about source-builds❔

This is specific to source-build at this time. This is something that would be needed if/when we move towards having reproducible builds. Also this would be the default behavior if/when we get to the point where source-build is the open build and then the MSFT build is a closed build. The last two have no concrete plans as of now.

I guess the general question is why Fedora and so on need a targeting pack every time. I thought their requirement was strictly runtime components❔

This is not Fedora specific rather it affects all source-build. I won't go into the details on why this is blocking Fedora and not RedHat here as it doesn't feel pertinent. The Microsoft build works because it is able to pull the previously build targeting pack from nuget. Source-build has to build the entire product stand-alone offline so it can't access artifacts from previous releases.

cc @crummel, @omajid - to correct anything I may have mis-stated.

@dougbu
Copy link
Member

dougbu commented Jan 14, 2022

🆗 I can see why building our stuff in the aspnetcore repo against the previous targeting pack would break source-build.

Do you specifically need

  1. A build that doesn't require the previous targeting pack i.e. remove reliance on the old ref/ assemblies❔
  2. A .nupkg for Microsoft.AspNetCore.App.Ref in every build (stable-versioned or not)❔
  3. A targeting pack installer (.rpm file) that's always built at least when doing source-build❔

@MichaelSimons
Copy link
Member Author

Do you specifically need

We need #2

@wtgodbe
Copy link
Member

wtgodbe commented Jan 14, 2022

Does it need to match the last stable version on nuget.org, or could we create a new non-stable version each month? I lean towards doing the former if it doesn't break maestro, as the latter would mean upstream repos ingesting new non-stable targeting packs every month. If we do the former we'd only do it in source build (@mmitche would that wind up in the asset manifest/dependency flow?)

@dougbu
Copy link
Member

dougbu commented Jan 14, 2022

The other option is to just always and forever ship Microsoft.AspNetCore.App.Ref.{stable version}.nupkg in every servicing release. This essentially ignores the source-build-specificity of the issue and would be incredibly simple to implement (delete one line).

@dougbu
Copy link
Member

dougbu commented Jan 14, 2022

@Pilchie would that last option cause any problems beyond inconsistency w/ the Windows Desktop and other targeting pack packages (something @safern and others could rectify over time)❔

@mmitche
Copy link
Member

mmitche commented Jan 14, 2022

@Pilchie would that last option cause any problems beyond inconsistency w/ the Windows Desktop and other targeting pack packages (something @safern and others could rectify over time)❔

We could align that behavior with the other runtimes and always ship the ref packs.

@dougbu
Copy link
Member

dougbu commented Jan 14, 2022

We could align that behavior with the other runtimes and always ship the ref packs.

I agree "could rectify over time" was annoyingly vague 😺

@Pilchie
Copy link
Member

Pilchie commented Jan 14, 2022

We could align that behavior with the other runtimes and always ship the ref packs.

I thought the other runtimes explicitly didn't always ship the ref packs. That was at least the design when we did the ref-pack/runtime-pack split.

@safern
Copy link
Member

safern commented Jan 14, 2022

Yes, the design spec included this:

Targeting pack package versions will generally not increase past major.minor.0 where major.minor matches the the corresponding two-part TFM. For example, when there is a 3.0.1 .NET Core runtime, the targeting pack will likely remain at 3.0.0. This follows from the fact that targeting packs represent public API surface, which must not change in a patch version of the runtime. (With that said, we can reserve the right to modify the targeting pack in a patch release to fix a severe bug. In the rare event that this occurs, the targeting pack patch version could be incremented past 0.)

However I think with source-generators and analyzers, now ref-packs (at least the .NETCore App one) is very likely to be serviced, at least in the early servicing cycles. When the split design spec was written the ref pack only carried ref assemblies and a bug in a ref assembly is pretty uncommon.

Given the new shape of ref packs and the likelihood for them to be serviced, I wouldn't mind servicing them every release.

@ericstj might have input on this as well.

@ericstj
Copy link
Member

ericstj commented Jan 14, 2022

Ref packs represent all the runtime-agnostic data for a framework. It's reference assemblies, xml docs, data files that describe the runtime content, and now analyzers and source generators.

Agree with @safern that the goal is to never change surface area for a given ref-pack, which is easy to do if you don't ship updates. I don't think however we must unnecessarily constrain this: it's not like ref-packs are some magical things that never have bugs. Even before we added analyzers/generators we've had to service ref packs. Sometimes we want to fix docs, sometimes we got the metadata in the reference assemblies wrong.

I'm open to always shipping them, especially if it reduces complexity in servicing. Around GA time frame I believe there was a discussion between @Anipik, @dsplaisted, and @mmitche (and maybe some others) and they concluded to continue to make it opt in. I'm not sure why, perhaps to reduce churn in the SDK? I'd want to make sure the SDK team is involved with whatever decision is made here since they are the most impacted by changes.

From the framework author side; I think the risk of accidentally shipping surface area changes is easily mitigated with APICompat automation. Similarly we could add automated testing to ensure data files do not change after GA.

@wtgodbe
Copy link
Member

wtgodbe commented Jan 14, 2022

I don't have any objections to always shipping the ref pack from aspnetcore - we already have automation that checks for API changes in servicing. @marcpopMSFT @dsplaisted any objections from the SDK side to everybody always shipping ref packs in 6.0+? @merriemcgaw @RussKie @dreddy-work any objections to doing this in WindowsDesktop?

@RussKie
Copy link
Member

RussKie commented Jan 14, 2022 via email

@dsplaisted
Copy link
Member

In the previous discussion, I wanted to avoid rebuilding the ref packs for every servicing release, because I felt that after the first few patches the frequency where there were actually changes would go way down.

However, if it's causing issues for source-build I suppose we can switch to producing them every patch. That would also have the benefit of not having to manually manage turning it on and off.

@Pilchie
Copy link
Member

Pilchie commented Jan 15, 2022

Just recording for the record that I'm not against shipping ref packs every release, just wanted to make sure other stakeholders were on board with the decision.

@dougbu
Copy link
Member

dougbu commented Jan 15, 2022

Who else do we need sign-off from before @wtgodbe or I put up a PR for our part in this❔

@Pilchie
Copy link
Member

Pilchie commented Jan 15, 2022

@timheuer / @jamshedd could we get a PM with an eye towards acquisition and deployment to weigh-in? That's the only group I haven't seen something from here.

@jamshedd
Copy link
Member

I recall we had an issue last year when we accidentally rebuilt and reshipped the ref pack last year, I cannot recall what the issue was though, maybe @leecow or @joeloff can recall.

@dougbu if we do ship these each month going forward then do we revision them to match the release and runtime version, or does the version "stick" at 6.0.0? I think we've had other issues where we've rebuilt products but not revisioned.

Another thing to keep in mind is we want to be consistent - if we ship the rebuilt ref pack with the SDK bundle then we also want to insert the same into VS, deliver that via MU, etc.

@dougbu
Copy link
Member

dougbu commented Jan 15, 2022

I suggest we change the version in every release of the ref/ packs e.g. Microsoft.AspNetCore.App.Ref as well as the targeting packs. That's what we did in past releases, when we fixed targeting pack bugs.

Another thing to keep in mind is we want to be consistent - if we ship the rebuilt ref pack with the SDK bundle then we also want to insert the same into VS, deliver that via MU, etc.

Does Microsoft.AspNetCore.App.Ref (and similar) or the targeting packs ever release via MU❔ I'd be surprised if Windows had this content.

Of course, VS insertions remain a slight issue but is the delta from today (where at least ASP.NET Core always builds and packs everything with the odd exception of Microsoft.AspNetCore.App.Ref and the targeting packs) a burden or an upside❔

@dougbu
Copy link
Member

dougbu commented Jan 17, 2022

For fun and frolic 😁, I put up a few options as draft PRs. We can choose between these and decide which should go into a 6.0.1 source-build patch, 6.0.3, and main. My preference would be to scorch the earth and do #39568 everywhere.

@dougbu
Copy link
Member

dougbu commented Jan 17, 2022

Also created a teensy option for 6.0.1:

Patch for this option, after squashing the two commits and adding .txt: 0001-Always-build-App.Ref-and-the-targeting-packs.patch.txt

@dougbu
Copy link
Member

dougbu commented Jan 17, 2022

Proposed way forward:

  1. We make Always build App.Ref and the targeting packs #39568 ready for review
  2. Once that's merged, we backport the change to release/6.0

In the meantime,

  1. Create a release/6.0.1 branch from the v6.0.1 tag
  2. Do one of the following:
    1. Apply the above patch in that branch
    2. Add the file wherever it needs to be for source-build to pick it up automatically
    3. Add <IsTargetingPackBuilding>true</IsTargetingPackBuilding> to our eng/SourceBuild.props file
  3. Provide the branch to RedHat or do the equivalent

I'm not sure which of the options will work because I don't see where Arcade-powered source-build loads patch files and am not sure SourceBuild.props gets loaded in a way that would be visible to other files in the inner build.

@MichaelSimons
Copy link
Member Author

I have created a source-build PR with this proposed patch along with a patch for a different but related runtime issue. Fedora can pick up these patches themselves to get unblock for 6.0.1.

@dougbu
Copy link
Member

dougbu commented Jan 18, 2022

I'd like to open #39568 for review and close the rest later today. Please respond w/ "yes, do this" or a more nuanced preference in the next few hours. (The conversation above ends mostly sounds more like "well 🆗" 😃 ).

@MichaelSimons
Copy link
Member Author

I'd like to open #39568 for review and close the rest later today.

yes, do this

@dougbu
Copy link
Member

dougbu commented Jan 18, 2022

Can we please get clear responses from runtime, WindowsDesktop and PM representatives❔

@dougbu
Copy link
Member

dougbu commented Jan 18, 2022

From dotnet/installer#13009, I understand dotnet/aspnetcore and dotnet/runtime are taking different approaches for the 6.0.1 patch. dotnet/aspnetcore will build all packages and installers (including the targeting packs) when the patched branch is built (whether in a source-build or not) but dotnet/runtime will build all packages only in a source-build. That's probably fine but is an inconsistency we should not carry forward to 6.0.3 and beyond. Let's have one plan for all three repos that produce targeting packs.

@MichaelSimons also mentioned WindowsDesktop isn't directly impacted by source-build. Nonetheless, Microsoft.WindowsDesktop.App.Ref should be part of the "6.0.3 and beyond" consistency.

@Pilchie
Copy link
Member

Pilchie commented Jan 18, 2022

@dougbu - I'll be engineering for WindowsDesktop.

@timheuer
Copy link
Member

Chiming in here from PM standpoint, the plan is understood and looks good to me.

@dougbu
Copy link
Member

dougbu commented Jan 18, 2022

Sign offs (and a nudge 😉):

  • source-build
  • runtime
  • aspnetcore
  • WindowsDesktop
  • sdk
  • PM

@dougbu
Copy link
Member

dougbu commented Jan 18, 2022

Sorry, we also heard an ack from @dsplaisted for the sdk team

@Pilchie
Copy link
Member

Pilchie commented Jan 18, 2022

I think @ericstj counts for runtime?

@dougbu
Copy link
Member

dougbu commented Jan 18, 2022

I think @ericstj counts for runtime?

Yes. I'm unsure whether @ericstj meant "we'll consider it" or "let's go forward" and want confirmation one way or the other.

@dougbu
Copy link
Member

dougbu commented Jan 19, 2022

/fyi I removed the extra PRs, declared #39568 ready for review, and opened

@ericstj
Copy link
Member

ericstj commented Jan 19, 2022

Yes, let's go forward. @safern also agreed above.

@dougbu
Copy link
Member

dougbu commented Sep 6, 2022

@MichaelSimons is there anything left to do here❔ If not, please close as done😺

@ghost ghost locked as resolved and limited conversation to collaborators Oct 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

No branches or pull requests