dependabot / dependabot-core

🤖 Dependabot's core logic for creating update PRs.
https://docs.github.com/en/code-security/dependabot
MIT License
4.53k stars 944 forks source link

Dependabot fails to update dependencies in .NET Aspire host project #9905

Open martincostello opened 1 month ago

martincostello commented 1 month ago

Is there an existing issue for this?

Package ecosystem

NuGet

Package manager version

No response

Language version

No response

Manifest location and content before the Dependabot update

/src/TweetiePie.AppHost/TweetiePie.AppHost.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <IsAspireHost>true</IsAspireHost>
    <OutputType>Exe</OutputType>
    <TargetFramework>$(DefaultTargetFramework)</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Aspire.Hosting.AppHost" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\TweetiePie\TweetiePie.csproj" />
  </ItemGroup>
</Project>

dependabot.yml content

version: 2
updates:
- package-ecosystem: nuget
  directory: "/"
  groups:
    Aspire:
      patterns:
        - Aspire.*
    AWSSDK:
      patterns:
        - AWSSDK.*
    Microsoft.Extensions:
      patterns:
        - Microsoft.Extensions.*
    OpenTelemetry:
      patterns:
        - OpenTelemetry*
    Polly:
      patterns:
        - Polly*
    Serilog:
      patterns:
        - Serilog*
    xunit:
      patterns:
        - xunit*
  schedule:
    interval: daily
    time: "08:30"
    timezone: Europe/London
  open-pull-requests-limit: 99

Updated dependency

None.

What you expected to see, versus what you actually saw

dependabot should update two AWSSDK NuGet packages to their latest version. Instead it fails with the following exception when processing the project file:

/opt/nuget/NuGetUpdater/NuGetUpdater.Cli update --repo-root /home/dependabot/dependabot-updater/repo --solution-or-project /home/dependabot/dependabot-updater/repo/src/TweetiePie.AppHost/TweetiePie.AppHost.csproj --dependency AWSSDK.SimpleSystemsManagement --new-version 3.7.304.19 --previous-version 3.7.304.17  --verbose
updater | 2024/06/05 09:36:39 ERROR <job_83758> Error processing AWSSDK.SimpleSystemsManagement (Dependabot::SharedHelpers::HelperSubprocessFailed)
2024/06/05 09:36:39 ERROR <job_83758> Updating global.json files.
    Dependency [AWSSDK.SimpleSystemsManagement] not found in any global.json files.
  No dotnet-tools.json files found.
Running for project [/home/dependabot/dependabot-updater/repo/src/TweetiePie.AppHost/TweetiePie.AppHost.csproj]
  Running for SDK-style project
Unhandled exception: System.IO.FileNotFoundException: Could not find file '/home/dependabot/dependabot-updater/repo/src/TweetiePie.AppHost/TweetiePie.AppHost.csproj.SdkResolver.1392955269.proj'.
File name: '/home/dependabot/dependabot-updater/repo/src/TweetiePie.AppHost/TweetiePie.AppHost.csproj.SdkResolver.1392955269.proj'
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.File.ReadAllText(String path, Encoding encoding)
   at NuGetUpdater.Core.ProjectBuildFile.Open(String repoRootPath, String path) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs:line 13
   at NuGetUpdater.Core.MSBuildHelper.<>c__DisplayClass13_0.<LoadBuildFiles>b__1(String path) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs:line 360
   at System.Linq.Enumerable.SelectArrayIterator`2.Fill(ReadOnlySpan`1 source, Span`1 destination, Func`2 func)
   at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at NuGetUpdater.Core.MSBuildHelper.LoadBuildFiles(String repoRootPath, String projectPath) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs:line 359
   at NuGetUpdater.Core.SdkPackageUpdater.UpdateDependencyAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive, Logger logger) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs:line 20
   at NuGetUpdater.Core.UpdaterWorker.RunForProjectAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 81
   at NuGetUpdater.Core.UpdaterWorker.RunAsync(String repoRootPath, String filePath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 42
   at NuGetUpdater.Cli.Commands.UpdateCommand.<>c__DisplayClass7_0.<<GetCommand>b__0>d.MoveNext() in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs:line 37
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/common/lib/dependabot/shared_helpers.rb:427:in `run_shell_command'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/sorbet-runtime-0.5.11142/lib/types/private/methods/call_validation.rb:153:in `bind_call'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/sorbet-runtime-0.5.11142/lib/types/private/methods/call_validation.rb:153:in `validate_call_skip_block_type'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/sorbet-runtime-0.5.11142/lib/types/private/methods/call_validation.rb:95:in `block in create_validator_slow_skip_block_type'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/native_helpers.rb:87:in `run_nuget_updater_tool'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/file_updater.rb:65:in `block in try_update_projects'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/file_updater.rb:59:in `each'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/file_updater.rb:59:in `try_update_projects'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/file_updater.rb:31:in `block in updated_dependency_files'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/file_updater.rb:30:in `each'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/nuget/lib/dependabot/nuget/file_updater.rb:30:in `updated_dependency_files'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/dependency_change_builder.rb:89:in `generate_dependency_files'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/dependency_change_builder.rb:37:in `run'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/dependency_change_builder.rb:26:in `create_from'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:95:in `create_change_for'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:56:in `block in compile_all_dependency_changes_for'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:29:in `each'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:29:in `compile_all_dependency_changes_for'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/create_group_update_pull_request.rb:70:in `dependency_change'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/create_group_update_pull_request.rb:44:in `perform'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:117:in `run_update_for'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:99:in `block in run_grouped_dependency_updates'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:98:in `each'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:98:in `run_grouped_dependency_updates'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:45:in `perform'
updater | 2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:64:in `run'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/update_files_command.rb:41:in `perform_job'
2024/06/05 09:36:39 ERROR <job_83758> /home/dependabot/dependabot-updater/lib/dependabot/base_command.rb:53:in `run'
updater | 2024/06/05 09:36:39 ERROR <job_83758> bin/update_files.rb:24:in `<main>'
updater | 2024/06/05 09:36:39 INFO <job_83758> Nothing to update for Dependency Group: 'awssdk'

I've not seen this in any of my projects in GitHub.com using .NET Aspire with similar project setups, but this is consistently failing for two internal projects using GitHub Enterprise Server after upgrading to 3.12.4.

Native package manager behavior

No response

Images of the diff or a link to the PR, issue, or logs

No response

Smallest manifest that reproduces the issue

No response

brettfo commented 2 weeks ago

This looks very similar to an issue I fixed in #9385. I'll take a look and see what we missed.

brettfo commented 2 weeks ago

This shouldn't be an issue. The PR I linked above fixed the issue and the stack trace is reporting this as coming from the function NuGetUpdater.Core.MSBuildHelper.LoadBuildFiles but 2 months ago in #9417 that function was renamed, so this log is coming from an old updater.

Was this from a GitHub run, or a private run? If a private run, you should be able to pull newer updater images. If it's a GitHub run I'll ask around to see how an older updater image might be getting pulled in.

martincostello commented 2 weeks ago

If that's the case that this is an already fixed issue, this just feeds further into my separate issue about how the in-box version of dependabot for GitHub Enterprise Server v3.12.4 is 6 months old and full of NuGet issues: #9887

brettfo commented 4 days ago

I'm going to tag @abdulapopoola on this one, I don't know about the GitHub Enterprise Server deployment schedule.