jenkins - 从 api.nuget.org 下载“BouncyCastle.1.8.6.1”时出错
问题描述
环境:Windows Server 2016 上的 Jenkins 2.249.1。
正在使用的命令是
nuget.exe install itextsharp.pdfa -PreRelease -Version 5.5.13.2 \
-OutputDirectory C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/src/extras/packages \
-Source 'C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/;https://api.nuget.org/v3/index.json'
这是控制台日志的相关部分:
02:17:42 Feeds used:
02:17:42 C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages
02:17:42 C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/
02:17:42 https://api.nuget.org/v3/index.json
02:17:42
02:17:42
02:17:42
02:17:42 Attempting to gather dependency information for package 'itextsharp.pdfa.5.5.13.2' with respect to project 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\packages', targeting 'Any,Version=v0.0'
02:17:43 Gathering dependency information took 215.09 ms
02:17:43 Attempting to resolve dependencies for package 'itextsharp.pdfa.5.5.13.2' with DependencyBehavior 'Lowest'
02:17:43 Resolving dependency information took 0 ms
02:17:43 Resolving actions to install package 'itextsharp.pdfa.5.5.13.2'
02:17:43 Resolved actions to install package 'itextsharp.pdfa.5.5.13.2'
02:17:43 Retrieving package 'BouncyCastle 1.8.6.1' from 'nuget.org'.
02:17:43 Retrieving package 'iTextSharp 5.5.13.2' from 'C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/'.
02:17:43 Retrieving package 'itextsharp.pdfa 5.5.13.2' from 'C:/Jenkins/workspace/itext_7_dotnet_pdfxfa_develop/'.
02:17:43 GET https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg
02:17:43 OK https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg 165ms
02:17:43 WARNING: Error downloading 'BouncyCastle.1.8.6.1' from 'https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg'.
02:17:43 Could not find file 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages\bouncycastle\1.8.6.1\bouncycastle.1.8.6.1.nupkg'.
02:17:43 GET https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg
02:17:43 OK https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg 24ms
02:17:43 WARNING: Error downloading 'BouncyCastle.1.8.6.1' from 'https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg'.
02:17:43 Could not find file 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages\bouncycastle\1.8.6.1\bouncycastle.1.8.6.1.nupkg'.
02:17:43 GET https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg
02:17:43 OK https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg 23ms
02:17:43 WARNING: Install failed. Rolling back...
02:17:43 Executing nuget actions took 482.72 ms
02:17:43 Error downloading 'BouncyCastle.1.8.6.1' from 'https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1.nupkg'.
02:17:43 Could not find file 'C:\Jenkins\workspace\itext_7_dotnet_pdfxfa_develop\src\extras\global-packages\bouncycastle\1.8.6.1\bouncycastle.1.8.6.1.nupkg'.
看起来好像nuget install
正在尝试 GET 3 次bouncycastle.1.8.6.1.nupkg
,看起来好像可行,而且我还验证了https://api.nuget.org/v3-flatcontainer/bouncycastle/1.8.6.1/bouncycastle.1.8.6.1。 nupkg是一个有效的 URL:当您打开此链接时,将下载一个 nupkg 文件。但是不知什么原因,无法下载?
已经试过了
packages
当我从and中删除 BouncyCastle 目录global-packages
,然后再次运行该作业时,BouncyCastle by 的下载nuget install
成功。
当我第三次运行该作业时,没有再次清除目录,它再次因相同的错误而失败。
我需要做什么才能nuget install
在所有情况下成功完成命令?
解决方案
我找不到根本原因,而且花费了太多时间,所以我采取了务实的方法。现在,我将始终在构建开始时删除 BouncyCastle,如下所示:
sh 'rm --force --recursive ${dest}/global-packages/bouncycastle'
它很脏,我并不为此感到自豪,但它确实有效。
推荐阅读
- unix - 是否有系统调用来查找某个路径是常规文件还是 unix 中的硬链接
- oracle - 在 oracle 中创建作业时出现编译错误
- clojure - 计算列表中项目之间的增量
- c++ - OpenCl 中的“CL_DEVICE_NOT_FOUND”
- java - 编译java程序时遇到问题,没有生成类文件
- here-api - 计算矩阵:行人路线的 walkSpeed 参数
- javascript - 我们应该如何从 AngularJS 1.6.4 升级到最新的 Angular 版本?
- angular - 无法理解亲子沟通
- javascript - Javascript尝试根据内部对象数组值对对象数组进行排序
- html - 使 img 忽略父填充并在响应时以负边距与容器边缘齐平