-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix BuildPass>1 artifacts and asset manifest content #45323
Conversation
8c9bacb
to
93fa476
Compare
Fixes dotnet/source-build#4778 There are three problems with the current implementation: 1. The asset manifest that gets produced in a BuildPass>2 build contains all the assets from the previous dependent vertical manifests. This is undesirable in general but also causes an issue when we merge all manifests together because there are duplicates that can't be resolved. 2. Artifacts from the dependent verticals get uploaded to the "<JobName>_Artifacts" pipeline artifact in CI in addition to the new artifacts produced which is a waste of resources. It also makes it harder to differentiate what actually got produced in the BuildPass>1 leg. 3. The log that lists all the artifacts that got produced by the repo build also outputs the artifacts from the dependent verticals because their manifests were considered as well. 4. Repo asset manifests from dependent verticals have the same name and therefore got ignored. Only the first one gets copied, all the other repo asset manifest files are ignored. --- Isolate the asset manifests that get produced by the build and then later read to generated the merged (vertical) manifest, from the downloaded dependent vertical manifests. Upload the vertical manifest only, instead of all the inner repo manifests. Name the manifest based on the job name to avoid conflicts. Don't upload everything under artifacts/assets and artifacts/packages. Instead read from the current vertical merged manifest to identify the assets to upload. Leverage an msbuild project for this that prepares the directory to upload. As part of that, also introduce a YML configuration property that defaults to Release and pass that into the build to be able to find the path to the vertical manifest without hardcoding a certain configuration.
82c54da
to
9063cc6
Compare
3d9f7ea
to
0aca7bc
Compare
/azp run sdk-unified-build-full |
Azure Pipelines successfully started running 1 pipeline(s). |
This one is ready. @mmitche PTAL |
0aca7bc
to
8ecc504
Compare
# Must be a path under $(sourcesPath). Inside the docker container, we mount $(sourcesPath) to /vmr | ||
# and can't write outside of that folder. | ||
- name: artifactsStagingDir | ||
value: $(sourcesPath)/artifacts/staging |
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.
If we weren't running our own custom docker process, could we default this to AzDO's Artifacts.StagingDirectory?
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.
Yes I believe that AzDO would pipe the inputs & outputs correctly. But I don't see an issue with creating the staging folder under artifacts (at least for now).
@@ -16,14 +16,14 @@ | |||
|
|||
<!-- After building, generate a prebuilt usage report. --> | |||
<Target Name="ReportPrebuiltUsage" | |||
AfterTargets="Build" | |||
BeforeTargets="Build" |
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.
Were these running in the wrong place, or is this just clean up?
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.
The BinPlaceFiles
target in the Directory.Build.targets file should run last so I hooked it up to run AfterTargets="Build"
. So I changed everything else to run BeforeTargets="Build"
. There were only a few places.
...t/eng/tools/tasks/Microsoft.DotNet.UnifiedBuild.Tasks/GetKnownArtifactsFromAssetManifests.cs
Show resolved
Hide resolved
.Distinct() | ||
.Select(package => new TaskItem(package.Attribute(IdAttributeName)!.Value, new Dictionary<string, string> | ||
{ | ||
{ PackageVersionAttributeName, package.Attribute(PackageVersionAttributeName)!.Value }, |
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.
Are you mainly adding the additional attributes here for completeness?
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.
Correct. We only need the NonShipping, RepoOrigin and Version ones. The DotNetReleaseShipping
is just here for completeness. The other changes in this file allow filtering artiafcts based on RepoOrigin
and enabling #nullable enable
to check for nullrefs.
Fixes dotnet/source-build#4778
There are three problems with the current implementation:
The asset manifest that gets produced in a BuildPass>2 build contains all the assets from the previous dependent vertical manifests. This is undesirable in general but also causes an issue when we merge all manifests together because there are duplicates that can't be resolved.
Artifacts from the dependent verticals get uploaded to the "_Artifacts" pipeline artifact in CI in addition to the new artifacts produced which is a waste of resources. It also makes it harder to differentiate what actually got produced in the BuildPass>1 leg.
The log that lists all the artifacts that got produced by the repo build also outputs the artifacts from the dependent verticals because their manifests were considered as well.
Repo asset manifests from dependent verticals have the same name and therefore got ignored. Only the first one gets copied, all the other repo asset manifest files are ignored.
Isolate the asset manifests that get produced by the build and then later read to generated the merged (vertical) manifest, from the downloaded dependent vertical manifests. Upload the vertical manifest only, instead of all the inner repo manifests. Name the manifest based on the job name to avoid conflicts.
Don't upload everything under artifacts/assets and artifacts/packages. Instead read from the current vertical merged manifest to identify the assets to upload. Leverage an msbuild target to bin place the artifacts into the staging directory to upload. As part of that, also introduce a YML configuration property that defaults to Release and pass that into the build to be able to find the path to the vertical manifest without hardcoding a certain configuration.
Here's a build from this PR that demonstrates that the changes work as expected: https://dnceng-public.visualstudio.com/public/_build/results?buildId=888307&view=logs&s=56cc5bc2-3154-5d19-920f-2db03d3b8537&j=287a7939-eab3-5c36-8f0e-00afcd687924