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

dotnet build in GetAllPackageDependenciesAsync failed. STDOUT: MSBuild version 17.8.3+195e7f5a3 for .NET #1004

Closed
HardikTathod opened this issue Feb 21, 2024 · 9 comments

Comments

@HardikTathod
Copy link

using azure devops extension for dependabot (Using azure repo + azure artifacts) as per log the feed and repo was authenticated. But still after fetching dependances it fails.

Initial logs:

          Pull Requests shall be linked to milestone (work item) 0
              2024-02-21T08:48:39.4956475Z Working in ORG/Presentation/_git/Presentation, 'DEV' branch under '/Sources' directory
              2024-02-21T08:48:39.4956945Z Cloning repository into /home/dependabot/dependabot-updater/tmp/ORG/Presentation/_git/Presentation
              2024-02-21T08:48:40.8018547Z Found 7 dependency file(s) at commit d94385e16f009f592aeffd870d87f
              2024-02-21T08:48:40.8019376Z 
                Parsing dependencies information
            2024-02-21T08:48:40.8081353Z 🌍 --> GET https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
            2024-02-21T08:48:40.9171459Z 🌍 <-- 200 https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
          Found 50 dependencies
          2024-02-21T08:49:53.1687797Z  - Microsoft.SourceLink.AzureRepos.Git (1.1.1)

After that

             🌍 --> GET https://pkgs.dev.azure.com/ORG/_packaging/342db4f4-79e8-40a5-9ccc-2795bcd623bb/nuget/v3/flat2/microsoft.sourcelink.azurerepos.git/8.0.0/microsoft.sourcelink.azurerepos.git.nuspec
    2024-02-21T08:49:53.7509076Z 🌍 <-- 200 https://pkgs.dev.azure.com/ORG/_packaging/342db4f4-79e9ccc-2795bcd623bb/nuget/v3/flat2/microsoft.sourcelink.azurerepos.git/8.0.0/microsoft.sourcelink.azurerepos.git.nuspec
    2024-02-21T08:49:53.7512599Z Updating Microsoft.SourceLink.AzureRepos.Git from 1.1.1 to 
    2024-02-21T08:49:53.7532685Z running NuGet updater:
    2024-02-21T08:49:53.7535016Z /opt/nuget/NuGetUpdater/NuGetUpdater.Cli update --repo-root /home/dependabot/dependabot-updater/tmp/Presentation/_git/Presentation --solution-or-project /home/dependabot/dependabot-updater/tmp/Presentation/_git/Presentation/Sources/.Presentation.KMZ/Presentation.KMZ.csproj --dependency Microsoft.SourceLink.AzureRepos.Git --new-version 8.0.0 --previous-version 1.1.1 --verbose
    2024-02-21T08:51:00.5719968Z   No dotnet-tools.json files found.
    2024-02-21T08:51:00.5720690Z Running for project [/home/dependabot/dependabot-updater/tmp/Presentation/_git/Presentation/Sources/ORG.Presentation.KMZ/ORG.Presentation.KMZ.csproj]
    2024-02-21T08:51:00.5721038Z   Running for SDK-style project
    2024-02-21T08:51:00.5721304Z dotnet build in GetAllPackageDependenciesAsync failed. STDOUT: MSBuild version 17.8.3+195e7f5a3 for .NET
    2024-02-21T08:51:00.5721584Z   Determining projects to restore...
    2024-02-21T08:51:00.5722122Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5722824Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5723503Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5724155Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5725815Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5726643Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5727472Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5728123Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5729099Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5730083Z /tmp/package-dependency-resolution_ILGrz1/Project.csproj : error NU1301: Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json.
    2024-02-21T08:51:00.5731111Z /usr/local/dotnet/current/sdk/8.0.100/NuGet.targets(156,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/ORG//_packaging/MY_Feed/nuget/v3/index.json. [/tmp/package-dependency-resolution_ILGrz1/Project.csproj]
    2024-02-21T08:51:00.5731878Z /usr/local/dotnet/current/sdk/8.0.100/NuGet.targets(156,5): error :   Response status code does not indicate success: 401 (Unauthorized). [/tmp/package-dependency-resolution_ILGrz1/Project.csproj]
    2024-02-21T08:51:00.5732096Z 

Following is my .azuredevops/dependabot.yml script
version: 2
registries:
my-nuget-feed:
type: nuget-feed
url: https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
username: [email protected]
token: "$(PAT):"

      updates:
        - package-ecosystem: "nuget"
          directory: "/Sources"
          schedule:
            interval: "Daily"
          target-branch: "DEV"
          registries:
            - my-nuget-feed 

and this is my Pipeline.

         trigger: none 
      
      schedules:
        - cron: '0 2 * * *' # daily at 2am UTC
          always: true 
          branches:
            include:
              - self
          batch: true
          displayName: Daily
      
      stages:
        - stage: CheckDependencies
          displayName: 'Check Dependencies'
          jobs:
            - job: Dependabot
              displayName: 'Run Dependabot'
              pool:
                vmImage: 'ubuntu-latest' 
              steps:
           
              - task: dependabot@1
                env:
                  AZURE_ACCESS_TOKEN: "$(AZURE_ACCESS_TOKEN):"

Please let me know if this is an issue for any changes are needed to work.

@mburumaxwell
Copy link
Contributor

The file contents provided are a bit mixed and are very likely wrong. Try the following:

For azure-pipelines.yml

trigger: none

schedules:
  - cron: "0 2 * * *" # daily at 2am UTC
    always: true
    branches:
      include:
        - self
    batch: true
    displayName: Daily

stages:
  - stage: CheckDependencies
    displayName: "Check Dependencies"
    jobs:
      - job: Dependabot
        displayName: "Run Dependabot"
        pool:
          vmImage: "ubuntu-latest"
        steps:
          - task: dependabot@1
            inputs:
              dockerImageTag: '1.24'

For dependabot.yml:

version: 2
registries:
  my-nuget-feed:
    type: nuget-feed
    url: https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
    token: ":$(AZURE_ACCESS_TOKEN)"

updates:
  - package-ecosystem: "nuget"
    directory: "/Sources"
    target-branch: "DEV"
    registries:
      - my-nuget-feed

Notes:

  • Use issue templates to make everyone's life easier. If not, at least format your issue description properly and provide all the information that would be necessary
  • The username is not used for nuget-feed
  • The token format should be :$(TOKEN) where TOKEN is an environment variable for a PAT or the current system token. If it should be otherwise, credit the source.
  • I have fixed the value dockerImageTag is fixed to 1.24 because of nuget authentication issues from version 1.25 #921

@HardikTathod
Copy link
Author

"Thank you for your quick response after updating. After updating the token with this token: ":$(AZURE_ACCESS_TOKEN)", the above error was resolved."

But I'm facing another issue Logs are as follow

     🌍 --> GET https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
    🌍 <-- 200 https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
    🌍 --> GET https://pkgs.dev.azure.com/ORG/_packaging/342db4f4-79e8-4/nuget/v3/flat2/microsoft.sourcelink.azurerepos.git/index.json
    🌍 <-- 200 https://pkgs.dev.azure.com/ORG/_packaging/342db4f4-79e8/nuget/v3/flat2/microsoft.sourcelink.azurerepos.git/index.json
    Requirements to unlock own
    Requirements update strategy 
    Updating Microsoft.SourceLink.AzureRepos.Git from 1.1.1 to 8.0.0
    Submitting Microsoft.SourceLink.AzureRepos.Git pull request for creation.
    🌍 --> GET https://dev.azure.com/ORG/Presentation/_apis/git/repositories/Presentation/commits
    🌍 <-- 200 https://dev.azure.com/ORG/Presentation/_apis/git/repositories/Presentation/commits
    🌍 --> GET https://pkgs.dev.azure.com/ORG/_packaging/342db4f4-79e8-40a5/nuget/v3/flat2/microsoft.sourcelink.azurerepos.git/8.0.0/microsoft.sourcelink.azurerepos.git.nuspec
    🌍 <-- 200 https://pkgs.dev.azure.com/ORG/_packaging/342db4f4-7/nuget/v3/flat2/microsoft.sourcelink.azurerepos.git/8.0.0/microsoft.sourcelink.azurerepos.git.nuspec
    🌍 --> GET https://github.com/dotnet/sourcelink.git/info/refs?service=git-upload-pack
    🌍 <-- 200 https://github.com/dotnet/sourcelink.git/info/refs?service=git-upload-pack
    🌍 --> GET https://github.com/dotnet/sourcelink.git/info/refs?service=git-upload-pack
    🌍 <-- 200 https://github.com/dotnet/sourcelink.git/info/refs?service=git-upload-pack
    🌍 --> GET https://dev.azure.com/ORG/Presentation/_apis/git/repositories/Presentation/refs?filter=heads/dependabot/nuget/Sources/DEV/Microsoft.SourceLink.AzureRepos.Git-8.0.0
    🌍 <-- 200 https://dev.azure.com/ORG/Presentation/_apis/git/repositories/Presentation/refs?filter=heads/dependabot/nuget/Sources/DEV/Microsoft.SourceLink.AzureRepos.Git-8.0.0
    🌍 --> POST https://dev.azure.com/ORG/Presentation/_apis/git/repositories/Presentation/pushes?api-version=5.0
    🌍 <-- 403 https://dev.azure.com/ORG/Presentation/_apis/git/repositories/Presentation/pushes?api-version=5.0
    /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/dependabot-common-0.237.0/lib/dependabot/clients/azure.rb:316:in `post': Dependabot::Clients::Azure::Forbidden (Dependabot::Clients::Azure::Forbidden)
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/sorbet-runtime-0.5.11141/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/sorbet-runtime-0.5.11141/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/sorbet-runtime-0.5.11141/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/dependabot-common-0.237.0/lib/dependabot/clients/azure.rb:170:in `create_commit'
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/dependabot-common-0.237.0/lib/dependabot/pull_request_creator/azure.rb:74:in `create_commit'
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/dependabot-common-0.237.0/lib/dependabot/pull_request_creator/azure.rb:42:in `create'
        from /home/dependabot/dependabot-updater/vendor/ruby/3.1.0/gems/dependabot-common-0.237.0/lib/dependabot/pull_request_creator.rb:118:in `create'
        from bin/update_script.rb:823:in `block in <main>'
        from bin/update_script.rb:539:in `each'
        from bin/update_script.rb:539:in `<main>'

"I have checked the permissions for Project Principal Build Service (ORG) and verified that it has the required permissions."

image

Also unchecked
image

Can you please help me out form this.

@HardikTathod
Copy link
Author

After unchecking this
image
It worked.
Thanks fo you time @mburumaxwell .

@HardikTathod
Copy link
Author

@mburumaxwell
If I want to set the NuGet policy for updates, say I want only NuGet packages that start with "ORG" to be checked and have PRs created for them, how can I do this?

@HardikTathod HardikTathod reopened this Feb 26, 2024
@mburumaxwell
Copy link
Contributor

The easiest way is to use the allow node but somehow they haven't been working as per #652 but you can give it a try.
The alternative is to use ignore for the packages you need to be skipped. Both options accept wildcards. Check the dependabot docs.

@HardikTathod
Copy link
Author

@mburumaxwell Thanks for your time I have check allow node it was not working. For now, i have used ignore.
I have few Issues.

  1. Once dependabot creates branches my local git repo was unable to fetch for pull.
    Logs

         error: cannot lock ref 'refs/remotes/origin/dependabot/nuget/Sources/DEV/Devart.Data-6.3.10': 
        'refs/remotes/origin/dependabot' exists; cannot create 
        'refs/remotes/origin/dependabot/nuget/Sources/DEV/Devart.Data-6.3.10'
    
  2. check_repo_response': The following source could not be reached as it requires authentication.
    I have a .dependabot.yml in which i have used variable $(PAT) and i have added PAT in pipeline variable as well as Pipeline library,
    It was able to find dependances clearly listed dependences. But after that fails with check repo response.

         version: 2
    

    registries:
    my-nuget-feed:
    type: nuget-feed
    url: https://pkgs.dev.azure.com/ORG/_packaging/MY_Feed/nuget/v3/index.json
    token: ":$(PAT)"

image
image

@HardikTathod
Copy link
Author

@mburumaxwell Is there something that you can help me with.

@mburumaxwell
Copy link
Contributor

At some point, authentication was working. What changed? Can you trace back to then? Could you instead try a PAT for your account which actually has access to both the repositories and private feeds?

@mburumaxwell
Copy link
Contributor

OP ghosted the issue 😨

@mburumaxwell mburumaxwell closed this as not planned Won't fix, can't repro, duplicate, stale Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants