2016-12-16 51 views
1

我想將祕密文件添加到我的工作中,但我無法從Jenkis DSL中找到哪個關鍵字,它有什麼建議?Jenkins DSL添加祕密文件

enter image description here

在XML中,它看起來是這樣的:

<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> 

回答

2

您可以在credentialsBinding範圍內使用file

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

有關詳細信息,請參閱API Viewer