How to export credentials from one jenkins instance to another?

后端 未结 5 2003
一向
一向 2020-12-13 20:35

I am using the credentials plugin in Jenkins to manage credentials for git and database access for my team\'s builds. I would like to copy the credentials from one jenkins i

5条回答
  •  死守一世寂寞
    2020-12-13 21:02

    This is what worked for me.

    Create a job in Jenkins that takes the credentials and writes them to output. If Jenkins replaces the password in the output with ****, just obfuscate it first (add a space between each character, reverse the characters, base64 encode it, etc.)

    I used a Powershell job to base64 encode it:

    [convert]::ToBase64String([text.encoding]::Default.GetBytes($mysecret))
    

    And then used Powershell to convert the base64 string back to a regular string:

    [text.encoding]::Default.GetString([convert]::FromBase64String("bXlzZWNyZXQ="))
    

提交回复
热议问题