Babu
Babu

Reputation: 5220

Jenkins DSL add secret file

I would like to add secret file to my job, but I can't find which keyword from Jenkis DSL it is, any suggestions?

enter image description here

In xml it looks like this:

<project>
...
<properties>...</properties>
<scm class="hudson.scm.NullSCM"/>
<builders>...</builders>
<buildWrappers>
  <org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper plugin="[email protected]">
     <bindings>
        <org.jenkinsci.plugins.credentialsbinding.impl.FileBinding>
            <credentialsId>my-keytab</credentialsId>
            <variable>KEYTAB</variable>
        </org.jenkinsci.plugins.credentialsbinding.impl.FileBinding>
     </bindings>
    </org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
</buildWrappers>
</project>

Upvotes: 1

Views: 2042

Answers (1)

daspilker
daspilker

Reputation: 8194

You can use file within the credentialsBinding context.

job('example') {
  wrappers {
    credentialsBinding {
      file('KEYTAB', 'my-keytab')
    }
  }
}

See the API Viewer for details.

Upvotes: 3

Related Questions