在skin,scp或sftp的jenkins管道中使用ssh凭据 [英] Use ssh credentials in jenkins pipeline with ssh, scp or sftp

查看:102
本文介绍了在skin,scp或sftp的jenkins管道中使用ssh凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用scp/ssh将一些文件上传到服务器.我发现我需要使用基于证书的身份验证,但是问题是如何?我真正想做的是使用与git一起使用的相同种类的凭据-存储在Jenkins中的带密码的ssh证书.但是,我不知道该怎么做-代码段生成器对此没有明显的选择.

I want to use scp/ssh to upload some files to a server. I discover that I need to use certificate-based authentication, but the question is how? Really what I want to do is to use the same sort of credentials I use with git - passworded ssh cert stored in Jenkins. However, I can't work out how to - the snippet generator has no obvious option for that.

其他人做什么?有没有记录的功能可以做到这一点?

What do others do? Is there an undocumented feature that would do this?

推荐答案

如果安装 SSH代理插件,您可以使用 ssh-agent 管道步骤,以在ssh-agent处于活动状态的情况下运行shell脚本. ssh-agent带有Jenkins凭证ID(一种密码ssh证书,类似于git的证书).

If you install the SSH Agent plugin you can use the ssh-agent pipeline step to run a shell script with an ssh-agent active. The ssh-agent takes a Jenkins credentials ID (a passworded ssh cert, like the one you have for git).

这篇关于在skin,scp或sftp的jenkins管道中使用ssh凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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