NuKeeperDotNet / NuKeeper

Automagically update nuget packages in .NET projects
Apache License 2.0
540 stars 129 forks source link

NuKeeper ignores configured private feed #1145

Open Slowacki opened 2 years ago

Slowacki commented 2 years ago

🐛 Bug Report

I'm trying to run NuKeeper in an Azure DevOps pipeline. However, I cannot seem to get it to use the private feed we use within the organization. If it's in the NuGet.config it's not being read at all, if it's passed through --source, it cannot authorize properly.

Configuration

azure-pipelines file:

trigger: none # don’t run as CI build

schedules:
  - cron: "0 0 * * *" # run daily at UTC midnight
    always: true
    displayName: Check for updated dependencies 
    branches: 
      include:
        - refs/heads/main

pool:
  vmImage: windows-latest

resources: 
  - repo: self

steps:
- checkout: self
  persistCredentials: True
- task: NuKeeper@0
  displayName: NuKeeper
  env:
    NuKeeper_azure_devops_token: $(System.AccessToken)
  inputs:
    version: '0.34.0'
    arguments: --consolidate --maxpackageupdates 10 --change minor --age 7d --targetBranch origin/main --verbosity detailed
    feed: '/{feed-guid}'

NuGet.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="SomeCustomFeed" value="https://pkgs.dev.azure.com/organization/_packaging/SomeCustomFeed/nuget/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
        <SomeCustomFeed>
          <add key="Username" value="{username}" />
          <add key="ClearTextPassword" value="{PAT}" />
        </SomeCustomFeed>
      </packageSourceCredentials>
</configuration>

execution log:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('D:\a\_temp\7702d78c-d8b5-4314-9f0c-c47aa43a48e3', 'D:\a\_temp\7702d78c-d8b5-4314-9f0c-c47aa43a48e3.unpacked')"
Caching tool: nukeeper 0.34.0 x64
C:\hostedtoolcache\windows\nukeeper\0.34.0\x64\NuGet.exe sources add -name organisationalScoped -source https://pkgs.dev.azure.com/org/_packaging/{feed-guid}/nuget/v3/index.json -username nukeeper -password *** -configFile D:\a\1\NuGet.config
Package source with Name: organisationalScoped added successfully.
"C:\Program Files\dotnet\dotnet.exe" C:\hostedtoolcache\windows\nukeeper\0.34.0\x64\NuKeeper.dll repo D:\a\1\s *** --consolidate --maxpackageupdates 10 --change minor --age 7d --targetBranch origin/main --verbosity detailed
Matched uri 'https://dev.azure.com/org/' to collaboration platform 'AzureDevOps'
FindPushFork. Fork Mode is SingleRepositoryOnly
2021-10-18T11:57:13Z: Started
...
Git clone complete
Reading file C:\Users\VssAdministrator\AppData\Roaming\NuGet\NuGet.Config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config for package sources
Read [nuget.org] : https://api.nuget.org/v3/index.json from file: 
Read [Microsoft Visual Studio Offline Packages] : file:///C:/Program Files (x86)/Microsoft SDKs/NuGetPackages/ from file: C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Found 88 packages
...
Determining projects to restore...
C:\Users\VssAdministrator\AppData\Local\Temp\NuKeeper\repo-9c9e12fde6e248f2ba32b915182059f0\src\project\project.csproj : error NU1101: Unable to find package OrganizationalPackage1. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org [C:\Users\VssAdministrator\AppData\Local\Temp\NuKeeper\repo-9c9e12fde6e248f2ba32b915182059f0\test\unit\testproject\testproject.csproj]
C:\Users\VssAdministrator\AppData\Local\Temp\NuKeeper\repo-9c9e12fde6e248f2ba32b915182059f0\src\project\project.csproj : error NU1101: Unable to find package OrganizationalPackage2. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org [C:\Users\VssAdministrator\AppData\Local\Temp\NuKeeper\repo-9c9e12fde6e248f2ba32b915182059f0\test\unit\testproject\testproject.csproj]
...

Expected behavior

NuKeeper reads the NuGet.config and uses the private feed defined there.

Version: 0.34.0

Platform if applicable:

vdurante commented 2 years ago

I am having the same issue. It correctly displays the outdated packages but doesn't update them

Bouke commented 2 years ago

This looks similar to #1035, which also describes a workaround we're using.