2016-11-04 113 views
0

我有一個Jenkins2管道(groovy)腳本,我希望能夠(可選地)使用p4 SCM取消擱置一個架子。我想需要的是這樣的:如何p4從Jenkins 2管道groovy腳本unshelve

checkout(
    [$class: 'PerforceScm', 
    credential: 'my-p4-credentials', 
    populate: 
     [$class: 'ForceCleanImpl', 
      have: false, 
      parallel: [enable: false, 
       minbytes: '1024', 
       minfiles: '1', 
       path: '/usr/local/bin/p4', 
       threads: '4'], 
      pin: p4shelf,   // <--! this variable is the shelf CL 
      quiet: true], 
    workspace: [$class: 'TemplateWorkspaceImpl', 
     charset: 'auto', 
     format: 'jenkins-${NODE_NAME}-${JOB_NAME}', 
     pinHost: false, 
     templateName: p4branch]]) 

回答

1

我通過P4-插件GitHub庫挖。基本上,這不能一步完成。取而代之的是,第一,我們必須從P4籤:

checkout([$class: 'PerforceScm', ...]) 

然後,我們必須做的取消擱置操作:

p4unshelve resolve: '', shelf: shelf, credential: 'jnsmith-p4-credentials' 

工程勢如破竹。