Skip to content

Commit

Permalink
Fix flakiness in Azure Functions (#6524)
Browse files Browse the repository at this point in the history
## Summary of changes

Attempt to fix flakiness in Azure Functions multi-sample build

## Reason for change

#6472 added multi-version
building for Azure Functions samples. Unfortunately, this caused the
build stage to be flaky, because Azure Functions apparently generates
and builds a [completely separate
_.csproj_](Azure/azure-functions-dotnet-worker#1252).
Unfortunately, it also ignores all the artifact output stuff, which
means when we restore/build multiple versions of the app (with different
api versions, it stomps over itself.

e.g. we can see the sample app build itself doing the right thing:
```
08:59:05 [DBG]   Samples.AzureFunctions.V4Isolated -> /project/artifacts/bin/Samples.AzureFunctions.V4Isolated/release_net6.0_1.6.0/Samples.AzureFunctions.V4Isolated.dll
08:59:06 [DBG]   Samples.AzureFunctions.V4Isolated -> /project/artifacts/publish/Samples.AzureFunctions.V4Isolated/release_net6.0_1.6.0/
```

But there's also the "WorkerExtensions" thing which is going completely
off the rails, ignores all of the Directory.Build.props etc and just
does its own thing

```
08:59:07 [DBG]   WorkerExtensions -> /tmp/oh4iajvh.kcj/publishout/
08:59:07 [DBG]   WorkerExtensions -> /tmp/zv30zzl2.cxz/publishout/Microsoft.Azure.Functions.Worker.Extensions.dll
08:59:08 [DBG]   WorkerExtensions -> /tmp/zv30zzl2.cxz/publishout/
```

Unfortunately, this shows it's trying to build two separate versions to
the same location, and things break.

## Implementation details

My initial attempt in
#6521 failed.

In this attempt I split the v1 SDK and v2 SDK into two separate
projects. The SDK versions are tracked separately. I was thinking that
as long as we only build a _single_ version per project we _should_ be
ok.

It was not OK.

So in the end I tore out the Azure Functions version tracking. We
could/should consider adding it back in some way, but right now this is
causing too many issues

An alternative is to just remove the Azure Functions samples from the
"auto-updating multi version".

I kept the split between v1 and v2 of the Azure Functions SDK to give us
a _little_ more coverage; I think it's about the best we can do.

## Test coverage

If this all finally passes, we should be good.

## Other details

An important thing to note is that _currently_, even though we will now
get dependabot notifactions about updates to the azure functions libs,
these _aren't_ tested automatically.

That's because currently our testing on Windows does _not_ run the
"multi version" tests like we do on Linux. And we _only_ test Azure
functions on Windows.

This is something I'd like to address longer term with PRs like #6498,
but for the meantime, we'll need to manually keep the samples up to date
with the latest SDK version when there's a dependabot PR
  • Loading branch information
andrewlock authored Jan 10, 2025
1 parent 633c749 commit c0b690a
Show file tree
Hide file tree
Showing 19 changed files with 773 additions and 367 deletions.
20 changes: 19 additions & 1 deletion Datadog.Trace.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 15.0.26124.0
Expand Down Expand Up @@ -596,6 +596,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoadContextResolve"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AspNet.MultipleAppsInDomain", "tracer\test\test-applications\aspnet\Samples.AspNet.MultipleAppsInDomain\Samples.AspNet.MultipleAppsInDomain.csproj", "{A82EB6F8-D8D0-4763-B252-08CA3F39D153}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tracer", "tracer", "{82FFBC1A-6B13-4C0A-896A-90306AE4828F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{07D12F26-2583-4C6F-AFBB-AA30FF339FC6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test-applications", "test-applications", "{F8C637E1-1F4F-4E3B-9E34-AAD61097C3F8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-functions", "azure-functions", "{FE9F14E0-8DFF-413B-BB9E-49CEA4115A5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AzureFunctions.V4Isolated.SdkV1", "tracer\test\test-applications\azure-functions\Samples.AzureFunctions.V4Isolated.SdkV1\Samples.AzureFunctions.V4Isolated.SdkV1.csproj", "{18767A3E-9ADC-485C-A8C7-50660D5B579D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1428,6 +1438,10 @@ Global
{A82EB6F8-D8D0-4763-B252-08CA3F39D153}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A82EB6F8-D8D0-4763-B252-08CA3F39D153}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A82EB6F8-D8D0-4763-B252-08CA3F39D153}.Release|Any CPU.Build.0 = Release|Any CPU
{18767A3E-9ADC-485C-A8C7-50660D5B579D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{18767A3E-9ADC-485C-A8C7-50660D5B579D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{18767A3E-9ADC-485C-A8C7-50660D5B579D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{18767A3E-9ADC-485C-A8C7-50660D5B579D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1660,6 +1674,10 @@ Global
{D6155F26-8245-4B66-8944-79C3DF9F9DA3} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A}
{8B1AF6A7-DD41-4347-B637-90C23D69B50E} = {498A300E-D036-49B7-A43D-821D1CAF11A5}
{A82EB6F8-D8D0-4763-B252-08CA3F39D153} = {AFA0AB23-64F0-4AC1-9050-6CE8FE06F580}
{07D12F26-2583-4C6F-AFBB-AA30FF339FC6} = {82FFBC1A-6B13-4C0A-896A-90306AE4828F}
{F8C637E1-1F4F-4E3B-9E34-AAD61097C3F8} = {07D12F26-2583-4C6F-AFBB-AA30FF339FC6}
{FE9F14E0-8DFF-413B-BB9E-49CEA4115A5D} = {F8C637E1-1F4F-4E3B-9E34-AAD61097C3F8}
{18767A3E-9ADC-485C-A8C7-50660D5B579D} = {FE9F14E0-8DFF-413B-BB9E-49CEA4115A5D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}
Expand Down
11 changes: 0 additions & 11 deletions tracer/build/PackageVersionsGeneratorDefinitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -743,16 +743,5 @@
"4.20.*",
"4.*.*"
]
},
{
"IntegrationName": "AzureFunctions",
"SampleProjectName": "Samples.AzureFunctions.V4Isolated",
"NugetPackageSearchName": "Microsoft.Azure.Functions.Worker",
"MinVersion": "1.6.0",
"MaxVersionExclusive": "3.0.0",
"SpecificVersions": [
"1.6.*",
"2.*.*"
]
}
]
24 changes: 0 additions & 24 deletions tracer/build/PackageVersionsLatestMajors.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -4558,29 +4558,5 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely
<RequiresDockerDependency>None</RequiresDockerDependency>
<SampleName>Samples.Selenium</SampleName>
</PackageVersionSample>
<PackageVersionSample Include="test\test-applications\azure-functions\Samples.AzureFunctions.V4Isolated\Samples.AzureFunctions.V4Isolated.csproj">
<Properties>ApiVersion=1.24.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
<TargetFramework>net6.0</TargetFramework>
<RequiresDockerDependency>None</RequiresDockerDependency>
<SampleName>Samples.AzureFunctions.V4Isolated</SampleName>
</PackageVersionSample>
<PackageVersionSample Include="test\test-applications\azure-functions\Samples.AzureFunctions.V4Isolated\Samples.AzureFunctions.V4Isolated.csproj">
<Properties>ApiVersion=2.0.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
<TargetFramework>net6.0</TargetFramework>
<RequiresDockerDependency>None</RequiresDockerDependency>
<SampleName>Samples.AzureFunctions.V4Isolated</SampleName>
</PackageVersionSample>
<PackageVersionSample Include="test\test-applications\azure-functions\Samples.AzureFunctions.V4Isolated\Samples.AzureFunctions.V4Isolated.csproj">
<Properties>ApiVersion=1.24.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
<TargetFramework>net7.0</TargetFramework>
<RequiresDockerDependency>None</RequiresDockerDependency>
<SampleName>Samples.AzureFunctions.V4Isolated</SampleName>
</PackageVersionSample>
<PackageVersionSample Include="test\test-applications\azure-functions\Samples.AzureFunctions.V4Isolated\Samples.AzureFunctions.V4Isolated.csproj">
<Properties>ApiVersion=2.0.0;RestoreRecursive=false;BuildProjectReferences=false</Properties>
<TargetFramework>net7.0</TargetFramework>
<RequiresDockerDependency>None</RequiresDockerDependency>
<SampleName>Samples.AzureFunctions.V4Isolated</SampleName>
</PackageVersionSample>
</ItemGroup>
</Project>
Loading

0 comments on commit c0b690a

Please sign in to comment.