使用“无法获取本地颁发者证书"的自签名 SSL 证书时,Azure DevOps 服务器管道构建失败在 NuGet 还原期间 [英] Azure DevOps Server pipeline build fails when using self-signed SSL certificate with "unable to get local issuer certificate" during NuGet restore

查看:45
本文介绍了使用“无法获取本地颁发者证书"的自签名 SSL 证书时,Azure DevOps 服务器管道构建失败在 NuGet 还原期间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 Azure DevOps Server 2019 后,自动管道构建在 NuGet 还原步骤失败,显示:

After upgrading to Azure DevOps Server 2019, automated pipeline builds are failing at the NuGet restore step showing:

错误:错误:无法获得本地颁发者证书

Error: Error: unable to get local issuer certificate

软件包无法恢复

微软的文档 指出在 Windows 上运行的构建代理使用 Windows 证书存储,因此我检查了构建服务器上是否正确安装了所需的证书,但它仍然失败.

Microsoft's documentation states that the build agent running on Windows uses the Windows certificate store, so I have checked that the required certificates are installed correctly on the build server, however it is still failing.

有许多问题具有相似的症状,但原因却不尽相同.经过调查,我找到了解决方案,但我没有在这个确切的问题上发现任何东西,所以我会发布一个答案,希望可以为其他人节省一些时间!

There are many questions with similar symptoms but not the same cause. After investigation, I have found the solution to this but I didn't spot anything on this exact issue so I will post an answer that will hopefully save somebody else some time!

推荐答案

事实证明,Azure DevOps 构建代理使用的是不使用 Windows 证书存储的 Node.js 版本.

It turns out that the Azure DevOps build agent is using a version of Node.js that doesn't use the Windows Certificate Store.

所需的解决方案是将 Node.js 指向自签名 SSL 证书的根 CA 证书的导出副本(*.cer 文件),使用名为 NODE_EXTRA_CA_CERTS 的系统环境变量或使用名为 NODE.EXTRA.CA.CERTS 的任务变量,其值指向证书.

The solution required is to point Node.js at an exported copy (*.cer file) of your self-signed SSL certificate's root CA certificate, using either a system environment variable called NODE_EXTRA_CA_CERTS or by using a Task Variable called NODE.EXTRA.CA.CERTS, with a value pointing to the certificate.

开发者社区问题链接

这篇关于使用“无法获取本地颁发者证书"的自签名 SSL 证书时,Azure DevOps 服务器管道构建失败在 NuGet 还原期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆