问题描述
因此,我尝试使用REST和XML创建SSH凭据,我正在使用类似curl的方法
curl -XPOST "$jenkins_url/credentials/store/system/domain/_/createCredentials" \
-u "$creds" \
-H "Content-Type:application/xml" \
-H "$crumb" \
-d @/tmp/credential.xml
这是我的/tmp/credential.xml内容
<com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey plugin="[email protected]">
<scope>GLOBAL</scope>
<id>A</id>
<description>A</description>
<username>A</username>
<privateKeySource class="com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource">
<privateKey>-----BEGIN OPENSSH PRIVATE KEY-----
here my long long long privkey
-----END OPENSSH PRIVATE KEY-----</privateKey>
</privateKeySource>
</com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey>
问题是凭据无效,直到我使用相同的私钥通过WebUI手动更新凭据为止,在/var/jenkins_home/credentials.xml
中,加密仅存储1行,
<com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey plugin="[email protected]">
<scope>GLOBAL</scope>
<id>A</id>
<description>A</description>
<username>A</username>
<privateKeySource class="com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey$DirectEntryPrivateKeySource">
<privateKey>{AQAAABAAAAAQM09i66XSFu72VLf9Y+1DzAKFM+A=}</privateKey>
</privateKeySource>
</com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey>
当我使用相同的私钥进行更新时,它会存储内容更长的不同密文。
我的卷曲请求有什么问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)