我有一个Jenkinsfile,它会克隆Git(dotnet代码)回购并尝试构建它。
执行dotnet restore
错误:
dotnet\sdk\3.0.100\NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json.
作品:
但是克隆回购后(由Jenkinsfile完成)
直接在Windows计算机的命令行上执行的 perl Build.pl
(具有dotnet restore
)效果很好
Jenkinsfile:
stage('pre-build') {
cleanWs()
checkout scm
}
stage('build') {
bat '''
echo "Build starting..."'
perl Build.pl //this perl script has `dotnet restore`command
'''
}
我不认为这是代理问题,因为使用相同的设置,我可以直接在Windows计算机上成功运行dotnet restore
。