如何解决Nuget受信任的签名者在Docker中无法通过一个URL失败,而对于其他URL则不会失败
我们在Nexus SonaType上托管了一个自定义的NuGet Feed。设置好了,我们为自己的存储库提供了一个提要,并为NuGet提供了一个“提要”。现在,我们也想在Docker中使用此供稿来自动运行测试,构建映像等。
由于我们拥有自己的证书,并且我们的服务位于代理之后,因此我在function fib1(n) {
if (n === 1) return 0;
if (n === 2) return 1;
return fib1(n - 1) + fib1(n - 2);
};
function fib2(n) {
return (() => {
if (n === 1) return 0;
if (n === 2) return 1;
return fib2(n - 1) + fib2(n - 2);
})();
};
function calculateAverageTime(func,iterations = 5) {
let sum = 0;
[...Array(iterations)].forEach(() => {
const start = new Date();
func();
const finish = new Date();
sum += (finish - start);
});
return Math.round(sum / iterations);
}
function compareByIterations(i) {
const fib1RunTime = calculateAverageTime(() => fib1(i));
const fib2RunTime = calculateAverageTime(() => fib2(i));
console.log(`Difference with ${i} iterations is ${(fib2RunTime - fib1RunTime) * 1000}ms`);
}
[10,20,30,40].forEach(i => compareByIterations(i));
Dockerfile
将两种服务作为源添加都可以正常工作,但是,一旦我想添加受信任的签名者,就会收到错误消息
ARG proxy
RUN dotnet nuget add source "https://sonatype-nexus.ourdomain.com/repository/releases/" --name "Digital Repository" --username "digital" --password $NUGET_USER_PASSWORD --store-password-in-clear-text
RUN dotnet nuget add source "https://sonatype-nexus.ourdomain.com/repository/nuget.org-proxy/" --name "NuGet Proxy"
RUN mono /usr/local/bin/nuget.exe config -set http_proxy="${proxy}"
RUN mono /usr/local/bin/nuget.exe trusted-signers add -Name "Digital Repository" -ServiceIndex "https://sonatype-nexus.ourdomain.com/repository/releases/index.json"
RUN mono /usr/local/bin/nuget.exe trusted-signers add -Name "NuGet Proxy" -ServiceIndex "https://sonatype-nexus.ourdomain.com/repository/nuget.org-proxy/index.json"
但是,当我取消评论时,只有Invalid certificate information from the service index 'https://sonatype-nexus.ourdomain.com/repository/releases/index.json'.
可用,它可以正常工作。只是一个失败了。
但是它们在同一个域中。一个怎么会因证书错误而失败,而另一个却不会失败?
更新
奇怪的是,两个nuget.org-proxy
的{{1}}都可以正常工作。实际上,只有证书才有问题:/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。