У меня есть приложение .Net Core, которое я пытаюсь создать на нашем новом сервере Jenkins, и у меня возникают проблемы с восстановлением пакетов NuGet.
Наша новая сборочная инфраструктура состоит из мастера Jenkins, работающего на CentOS, и эта конкретная сборка выполняется на ведомом сервере Windows Server 2012. Соединение между ними через SSH через Cygwin.
Эта сборка прекрасно работает на нашем старом Jenkins, который не имеет ведомых сборок и работает на Windows Server 2012.
Мы используем Jenkinsfile для вызова целей сборки NAnt для запуска сборки. Вот цель восстановления из файла сборки NAnt:
<target name="restore_nuget_packages" description="Restores the NuGet packages for the solution" >
<echo message="Restoring NuGet Packages" />
<property name="USERPROFILE" value="${environment::get-variable('USERPROFILE')}" />
<property name="HOME" value="${environment::get-variable('HOME')}" />
<echo message="USERPROFILE is ${USERPROFILE}" />
<echo message="HOME is ${HOME}" />
<exec program="${dotnet_path}" commandline="restore ${projectName}.sln"></exec>
</target>
Когда эта цель запускается на нашем новом сервере, я получаю следующий вывод:
[NuGet Restore] restore_nuget_packages:
[NuGet Restore]
[NuGet Restore] [echo] Restoring NuGet Packages
[NuGet Restore] [echo] USERPROFILE is C:/Users/jenkinslvadmin
[NuGet Restore] [echo] HOME is C:\Users\jenkinslvadmin
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery\Microservice.NotificationDelivery.csproj...
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery\Microservice.NotificationDelivery.csproj...
[NuGet Restore] [exec] Restoring packages for E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.Tests\Microservice.NotificationDelivery.Tests.csproj...
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration.Tools'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NETCore.App'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NETCore.App'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='jose-jwt'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='jose-jwt'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='MailKit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='MailKit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper.Extensions.Microsoft.DependencyInjection'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='AutoMapper.Extensions.Microsoft.DependencyInjection'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='FluentValidation.AspNetCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] c:\program files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] c:\program files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error : Value cannot be null. [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] c:\program files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error : Parameter name: path1 [E:\Git\<some_company>.microservice.notificationdelivery\azure_build\azure_build\Microservice.NotificationDelivery.sln]
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='FluentValidation.AspNetCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.CodeAnalysis.CSharp.Workspaces'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.CodeAnalysis.CSharp.Workspaces'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.EntityFrameworkCore.SqlServer'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Moq'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='Moq'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit3TestAdapter'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='NUnit3TestAdapter'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.Contracts'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.Contracts'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.ServiceBus'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.ServiceBus'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.State'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore] [exec] Retrying 'FindPackagesByIdAsyncCore' for source 'https://proget.<some_company>.com/nuget/Microservice.Core/FindPackagesById()?id='<some_company>.Microservice.Core.State'&semVerLevel=2.0.0'.
[NuGet Restore] [exec] Value cannot be null.
[NuGet Restore] [exec] Parameter name: path1
[NuGet Restore]
[NuGet Restore] BUILD FAILED
Я обнаружил и другие подобные проблемы:
https://github.com/dotnet/core/issues/1037#issuecomment-338315953
https://blog.jongallant.com/2017/12/dotnet-value-cannot-be-null-parameter-name-path1/
https://github.com/dotnet/cli/issues/2385
Они наводят меня на мысль, что проблема в том, что переменные USERPROFILE или HOME имеют значение null для Windows и Linux соответственно. dotnet использует эти переменные для своего кэша пакетов NuGet, и метод Path.Combine () выдает ошибку при построении пути к% USERPROFILE% .nuget \ packages.
Подозревая, что это может быть проблема с мастером под управлением Linux и ведомым устройством под управлением Windows, я попытался установить обе эти переменные на самом узле сборки (я убедился, что установил USERPROFILE явно, даже если он уже должен быть определен) , а также в конфигурации переменных среды узла сборки в пользовательском интерфейсе Jenkins. Увы, я все еще получаю ошибку. Я даже включил эхо в верхнюю часть целевого вывода, и, как вы можете видеть, эти переменные действительно установлены правильно, но команда dotnet restore все еще выдает ошибку.
Любые предложения о том, что я мог бы пропустить?