Q:

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?

In xml it looks like this:
<project>
...
<properties>...</properties>
<scm class="hudson.scm.NullSCM"/>
<builders>...</builders>
<buildWrappers>
  <org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper plugin="credentials-binding@1.10">
     <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>

A:

You can use file within the credentialsBinding context.
job('example') {
  wrappers {
    credentialsBinding {
      file('KEYTAB', 'my-keytab')
    }
  }
}

See the API Viewer for details.

