-
Notifications
You must be signed in to change notification settings - Fork 347
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
Add task to download files from helix results container #2103
Conversation
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.
Overall, I think this looks fine, but it really should be made so that it doesn't undo the work done in #1991.
src/Microsoft.DotNet.Helix/Sdk/tools/download-results/DownloadFromResultsContainer.targets
Outdated
Show resolved
Hide resolved
src/Microsoft.DotNet.Helix/Sdk/tools/download-results/DownloadFromResultsContainer.targets
Outdated
Show resolved
Hide resolved
@alexperovich @jonfortescue this is ready for another round of reviews. |
Inputs="unused" | ||
Outputs="%(SentJob.Identity)"> | ||
<ItemGroup> | ||
<_workItemsWithDownloadMetadata Include="@(HelixWorkItem)" Condition="'%(HelixWorkItem.DownloadFilesFromResults)' != ''" /> |
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 think you actually need to empty these item groups before adding things to them. IIRC this will currently write the metadata for jobs 1 and 2 together in the file for 2 because the item group has been filled with both.
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 haven't seen this behavior locally, but it doesn't hurt to empty this item group.
Actually the metadata itemgroup was correctly written for multiple jobs. No duplication at all.
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.
Hrm, I wonder if there is some msbuild magic with batching that is making the items not show 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.
Maybe because the ItemGroup is within the scope of the target and since we're batching it creates 2 different copies and evaluations of it? Basically 2 different scopes? @ericstj might know.
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 believe the side-effects of a batched target aren't observable until after all batches of that target run.
Try this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<_newProperty>unset</_newProperty>
</PropertyGroup>
<ItemGroup>
<TestItem Include="Abc" />
<TestItem Include="123" />
</ItemGroup>
<Target Name="BatchTarget" Inputs="%(TestItem.Identity)" Outputs="Unused">
<Message Text="BatchTarget Property: $(_newProperty)" Importance="High" />
<ItemGroup>
<_newItem Include="@(TestItem)" />
</ItemGroup>
<PropertyGroup>
<_newProperty>@(TestItem)</_newProperty>
</PropertyGroup>
<Message Text="BatchTarget: @(_newItem)" Importance="High" />
</Target>
<Target Name="TestTarget" DependsOnTargets="BatchTarget">
<Message Text="TestTarget Property: $(_newProperty)" Importance="High" />
<Message Text="TestTarget: @(_newItem)" Importance="High" />
</Target>
</Project>
Output of this is:
BatchTarget Property: unset
BatchTarget: Abc
BatchTarget Property: unset
BatchTarget: 123
TestTarget Property: 123
TestTarget: Abc;123
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.
Since we don't intend to use this items outside the target I guess we're safe on leaving it as is.
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, do you need a newer Azure storage client? https://docs.microsoft.com/en-us/dotnet/api/microsoft.windowsazure.storage.blob.cloudblob.downloadtofileasync?view=azure-dotnet#Microsoft_WindowsAzure_Storage_Blob_CloudBlob_DownloadToFileAsync_System_String_System_IO_FileMode_System_Threading_CancellationToken_ |
c67e43d
to
85c8b65
Compare
Yes, they actually split up the new version into multiple packages. They stopped building WindowsAzure.Storage and created multiple packages. So figuring out which ones we need. |
49cb506
to
3e862cb
Compare
Actually I just deleted the commit, Helix.SDK AzurePipelines task was not happy with the Newtonsoft upgrade required by the new azure SDKs. I will leave it as is, without flowing the cancellation token to |
Yeah it probably needs the AssemblyResolver I'm ok with you undoing the cancellation for now, but it's something you should consider moving forward for tasks which do long running things. Not implementing cancellation means a control-C will hang until the task completes. You can kill the process but that doesn't give a flushed log (so if you're working remote you might be missing the info for diagnosing). |
I don't think it is the AssemblyResolver, since the AzureDevOpsTask has BaseTask as its base class and it actually enables the AssemblyResolver for the desktop implementation: https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Helix/Sdk/BaseTask.Desktop.cs#L9 |
Yeah, makes sense. Maybe moving the |
Contributes to: #2076
This pr adds a Task for helix jobs to be able to download a file from the results container after a helix run, i.e testResults.xml or coverage.xml.
HelixWorkItem
should include a metadata entry to specify which files it needs to download:$(HelixResultsDestinationDir)
.BUILD_SOURCESDIRECTORY
property is available (predefined variable in Azure DevOps), it defaults to$(BUILD_SOURCESDIRECTORY)/artifacts/helixresults
.BUILD_SOURCESDIRECTORY
is empty, it would log a warning and will not execute the task.HelixTargetQueue
for the same payload. This folder will be named with the JobId.metadata.txt
file, that will contain the following information:More metadata can be specified to be written into this file, through and ItemGroup =>
HelixDownloadResultsMetadata
5. Under the Job directory, there will be a directory for every
HelixWorkItem
that specified theDownloadFilesFromResults
metadata, and under that folder it will contain the files that where available for download.6. If a file is not found within the container, a Warning will be logged through MSBuild.
The structure of the directory will look as follows:
cc: @ViktorHofer @danmosemsft @markwilkie @Chrisboh