问题描述
我正在使用ansible组装一台显影机.在那台机器上,我正在安装詹金斯.
I am putting together a developer machine using ansible. In that machine i am installing jenkins.
我用ansible为jenkins创建了工作:
I have created the jobs for jenkins with ansible:
- shell: "java -jar {{ jenkins.cli_jar }} -s {{ jenkins.server }} create-job \
{{ item.name }} < {{ jenkins.jobs_dir }}/{{ item.xml_file }}"
with_items: "jenkins.jobs"
并通过cli等安装了插件.
And installed the plugins, via cli etc.
但是现在我缺少工作的ssh凭证;我只想要带有用户"jenkins"的ssh凭证,并且使用来自Jenkins主〜/.ssh".
But now i am missing the ssh credentials for the jobs; i just want a ssh credential with user "jenkins" and that uses "From the Jenkins master ~/.ssh".
我正在谈论的是这种类型的凭据:
This type of credentials are the ones i am talking about:
也许是一个普通的脚本,但是我没有找到很多有关它的信息.感谢您的帮助.
Maybe is a groovy script but i haven't find a lot of information about it. Thanks for the help.
推荐答案
Jenkins凭证插件不允许使用API创建凭证( https://issues.jenkins-ci.org/browse/JENKINS-28407 ).
Jenkins credentials plugin doesn't allow credentials creation using API (https://issues.jenkins-ci.org/browse/JENKINS-28407).
一个可行的解决方案是使用您喜欢的浏览器和JMeter代理或Selenium IDE记录凭据创建.并使用JMeter CLI重放它,或将Selenium记录的测试另存为常规脚本.
A viable solution would be recording a credential creation using your prefered browser and JMeter proxy or Selenium IDE. and replaying it using JMeter CLI or saving the Selenium recorded test as a groovy script.
您还可以查看 https://github.com/jenkinsci/credentials -plugin/pull/33
这篇关于我想通过ansible创建詹金斯凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!