我有一个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]])
我翻遍了p4-plugin github的repo。基本上,这不是一步到位的。相反,首先,我们必须从p4:
签出。checkout([$class: 'PerforceScm', ...])
然后,我们必须做一个unshelve操作:
p4unshelve resolve: '', shelf: shelf, credential: 'jnsmith-p4-credentials'
效果非常好