Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Pipeline Syntax for "p4sync"

I'm trying to sync to Perforce in my pipeline script, but from the documentation I don't see a way to set the "workspace behavior", even though the plugin itself seems to have that capability.

I want the "workspace" to be equivalent to the setting "Manual (custom view)" I can configure in the UI as described here. What parameters do I need to pass to the p4sync task to achieve that?

like image 900
Tilo Avatar asked Sep 19 '16 23:09

Tilo


1 Answers

You will need to use the full checkout DSL, the p4sync DSL is only basic. The easiest way is to use the snippet generator (Pipeline Syntax link), select checkout: General SCM then Perforce Software from the SCM list.

You will then be able to define a detailed View. For example:

checkout([
  $class: 'PerforceScm', 
  credential: 'phooey1666', 
  populate: [
    $class: 'AutoCleanImpl', 
    delete: true, 
    modtime: false, 
    pin: '', 
    quiet: true, 
    replace: true
  ], 
  workspace: [
    $class: 'ManualWorkspaceImpl', 
    charset: 'none', 
    name: 'jenkins-${NODE_NAME}-${JOB_NAME}', 
    pinHost: false, 
    spec: [
      allwrite: true, 
      clobber: false, 
      compress: false, 
      line: 'LOCAL', 
      locked: false, 
      modtime: false, 
      rmdir: false, 
      streamName: '',
      view: '''
        //depot/... //jenkins-${NODE_NAME}-${JOB_NAME}/...
        -//depot/tests/... //jenkins-${NODE_NAME}-${JOB_NAME}/tests/...'''
    ]
  ]
])
like image 108
paul allen Avatar answered Sep 23 '22 12:09

paul allen