如何从Jenkins 2管道groovy脚本p4取消搁置

时间:2016-11-04 04:34:26

标签: jenkins groovy jenkins-pipeline perforce

我有一个Jenkins2管道(groovy)脚本,我希望能够(可选)使用p4 SCM取消搁置架子。我我需要这样的东西:

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 个答案:

答案 0 :(得分:2)

我挖掘了p4-plugin github repo。基本上,这不可能一步完成。相反,首先,我们必须从p4结帐:

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

然后,我们必须做一个不正常的操作:

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

像大佬一样工作。