jenkins配置相关

一、背景:

        1、jenkins安装在win上,需要将win上指定目录的文件上传上linux中,然后在linux中执行shell命令

        2、在Windows环境通过pscp的命令实现文件上传

二、问题说明

在执行任务构建时发生如下报错:

提示需要手动输入才能连接成功,但是jenkins是非交互的,不能手动输入

22:16:48 Started by upstream project "test" build number 23
22:16:48 originally caused by:
22:16:48  Started by user test
22:16:48 Running as SYSTEM
22:16:48 Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\test\default
22:16:48 [default] $ cmd /c call C:\Windows\TEMP\jenkins11633612435305521318.bat
22:16:48 开始上传文�?
22:16:48 pscp -l root -pw root@123++ -r "D:\Dev Files\Code\JavaProject\School\Lunwen Project\dist.zip" root@192.168.140.128:/home/app/
22:16:48 The host key is not cached for this server:
22:16:48   192.168.140.128 (port 22)
22:16:48 You have no guarantee that the server is the computer you
22:16:48 think it is.
22:16:48 The server's ssh-ed25519 key fingerprint is:
22:16:48   ssh-ed25519 255 SHA256:FepiLHDoxATcD3toC1U56nqlJ6sRp/qom5S13Hh0HBU
22:16:48 If you trust this host, enter "y" to add the key to PSCP's
22:16:48 cache and carry on connecting.
22:16:48 If you want to carry on connecting just once, without adding
22:16:48 the key to the cache, enter "n".
22:16:48 If you do not trust this host, press Return to abandon the
22:16:48 connection.
22:16:48 Store key in cache? (y/n, Return cancels connection, i for more info) Connection abandoned.
22:16:48 Lost connection
22:16:48 上传文件成功
22:16:48 Build step 'Execute Windows batch command' marked build as failure
22:16:48 Finished: FAILURE

三、解决方案

        添加pscp的参数-hostkey指定日志中提示的信息,这样就能构建成功了

pscp -l root -pw 123456 -hostkey SHA256:FepiLHDoxATcD3toC1U56nqlJ6sRp/qom5S13Hh0HBU -r "D:\JavaProject\School\dist.zip" root@192.168.150.110:/home/app/

四、总结

希望此篇文章可以帮到有需要的同学,加油

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值