jenkins中的SVN命令行由于服务器证书不匹配而失败 [英] SVN command line in jenkins fails due to server certificate mismatch

查看:526
本文介绍了jenkins中的SVN命令行由于服务器证书不匹配而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从Jenkins shell运行svn命令行时,出现此错误:

When I run the svn command line from the Jenkins shell I get this error:

 D:\Jenkins\jobs\Merge Trunk to Stable\workspace\stable>svn up --trust-server-cert --non-interactive 
 Updating '.':
 svn: E175002: Unable to connect to a repository at URL 'https://xxx/stable'
 svn: E175002: OPTIONS of 'https://xxx/stable': Server certificate verification failed: certificate issued for a different hostname,  issuer is not trusted (https://xxx)

但是当我从命令行CMD窗口运行相同命令时,就可以了:

But when I run the same from the command line CMD window it is OK:

 D:\Jenkins\jobs\Merge Trunk to Stable\workspace\stable>svn up
 Updating '.':
 At revision 1797.

 D:\Jenkins\jobs\Merge Trunk to Stable\workspace\stable>svn up --trust-server-cert --non-interactive
 Updating '.':
 At revision 1797.

有什么办法解决这个问题吗?

Any idea how to solve this??

推荐答案

相当老的问题,但仍然很生动.

Pretty old question, but still quite alive.

您知道,问题在于接受的证书高速缓存(以及用户名/密码高速缓存)是按用户使用的,并且由于Jenkins以不同的用户身份运行(很可能是SYSTEM),因此它不知道您的常规用户缓存.

As you know, the problem is that the accepted certificate cache (as well as the username/password cache) is per-user, and since Jenkins is running as a different user (most likely SYSTEM), it has no idea of your regular user cache.

并非所有SVN客户端都允许您在此处执行回显p"操作(这对我不起作用),并且--trust-server-cert在这种情况下显然也不起作用.

Not all SVN clients let you do the "echo p" thing there (it didn't work for me), and the --trust-server-cert apparently doesn't work in this case either.

对我有用的是

What worked for me was to open a console window as SYSTEM, and do the interactive acceptcertificate-login-password dance in there.

由于所有这些都已缓存,因此只需要执行一次,然后所有svn up和类似请求都将起作用.

Since all of this is cached, you only need to do this once, and from then on, all svn up and similar requests will work.

这篇关于jenkins中的SVN命令行由于服务器证书不匹配而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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