如何在Jenkins非管道作业中使用秘密文件

问题描述 投票:-1回答:1

我在全局凭据中定义了一个秘密文件ansible,并上传了私钥.pem文件。凭据可用于系统中的所有节点。然后,我在Jenkins作业中使用了凭据参数,如下所示。

enter image description here

[在工作的装订部分中,我已经提到了keyfile,如下所示:

enter image description here

问题是,当我在execute shell中引用此keyfile时,它应该引用我的私钥文件,但这没有发生:(

echo ${keyfile}

ssh -i "${keyfile}" ec2-user@server

而且我得到了错误。

Warning: Identity file ansible not accessible: No such file or directory.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Host key verification failed.

有什么想法吗?

bash jenkins jenkins-pipeline jenkins-plugins jenkins-cli
1个回答
0
投票

似乎您无法在Jenkins的非管道作业中使用全局凭据。

© www.soinside.com 2019 - 2024. All rights reserved.