1
votes

I have a lot of free-style jobs in my Jenkins instance. I create them with Jenkins API (generate XML-file with configuration and post them by "http://my-jenkins-instance:8080/createItem?name=JobName"). There is one problem - I can not generate value in secret fields. For example, I want such a config:

Inject passwords to the build as environment variables -> Job passwords. And I need to set 123 to Password field. I can not do this through XML because it appears decoded in XML. Something like this: {AQAAABAAAANwHq0hsSF6...}

I want to set the value to this parameter

So my questions are:

  1. Can I get the decoded value of a plain password through some API? So I could send 123 and get {AQAAABAAAANwHq0hsSF6...} back.
  2. If not, can I set secret value some other way? I can only think of using Selenium but it is too slow (comparing to API).
1

1 Answers

0
votes

I have found the solution. I can set the value as a plain text: <value>123</value>, create or update a job. Then I need to disable and enable the job.