简体   繁体   English

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

[英]How to use the secret file in a Jenkins Non Pipeline Jobs

I have a defined a secret file ansible in the global credentials and uploaded the private key .pem file.我在全局凭证中定义了一个秘密文件ansible并上传了私钥.pem文件。 The credentials is available to all the nodes in the system.凭据可用于系统中的所有节点。 Then I used the credentials parameter in the Jenkins job as you can see below.然后我在 Jenkins 作业中使用了 credentials 参数,如下所示。

在此处输入图像描述

In the bindings section of the job I have referred to the keyfile as you can see below:在作业的绑定部分,我引用了keyfile ,如下所示:

在此处输入图像描述

Problem is when I refer to this keyfile in the execute shell it should refer to my private key file but that's not happening:(问题是当我在执行 shell 中引用这个keyfile文件时,它应该引用我的私钥文件,但那没有发生:(

echo ${keyfile}

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

and I am getting the error.我收到了错误。

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.

Any ideas what's going on here?知道这里发生了什么吗?

Seems like you cannot use global credentials in non-pipeline jobs in Jenkins.似乎您不能在 Jenkins 中的非管道作业中使用全局凭据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM