Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57314

P4 Sync to label after sync to head without deleting non labeled files

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • linux

      I've created a perforce workspace and I've sync it to the head version.

      However I would like to sync the same workspace to a label but without deleting files that are not in the label. Like running the command p4 sync <workspace>/... @=label . 

      I've tried many combinations of the populate command but all of them have run something like  p4 sync <arguments><workspace>/... @label 

      Is there a way to run the p4sync command on jenkins so that it run a p4 sync ** @= command?*

       

      Thanks!

          [JENKINS-57314] P4 Sync to label after sync to head without deleting non labeled files

          Jose Valverde created issue -

          Karl Wirth added a comment -

          Hi citylife4 - Not sure so I will try it out here and get back to you with my findings.

          Karl Wirth added a comment - Hi citylife4 - Not sure so I will try it out here and get back to you with my findings.
          Karl Wirth made changes -
          Assignee New: Karl Wirth [ p4karl ]
          Jose Valverde made changes -
          Description Original: I've created a perforce workspace and I've sync it to the head version.

          However I would like to sync the same workspace to a label but without deleting files that are not in the label. Like running the command p4 sync <workspace>/... @=label . 

          I've tried with may continuations of the populate command but all of them have run something like  p4 sync <arguments><workspace>/... @label 

          Is there a way to have a to run the p4sync command to create a *@= command?*

           

          *Thanks!*
          New: I've created a perforce workspace and I've sync it to the head version.

          However I would like to sync the same workspace to a label but without deleting files that are not in the label. Like running the command p4 sync <workspace>/... @=label . 

          I've tried many combinations of the populate command but all of them have run something like  p4 sync <arguments><workspace>/... @label 

          Is there a way to run the p4sync command on jenkins so that it run a p4 sync *** *@= command?*

           

          *Thanks!*

          Karl Wirth added a comment -

          Hi citylife4. I have not been able to find a way to do this so will mark this as an enhancement request for the developers. The workaround would be to do the whole sync using P4Groovy:

             https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/p4groovy.html?Highlight=P4Groovy

          You could then specify the command line you need for the sync.

          Karl Wirth added a comment - Hi citylife4 . I have not been able to find a way to do this so will mark this as an enhancement request for the developers. The workaround would be to do the whole sync using P4Groovy:    https://www.perforce.com/manuals/jenkins/Content/P4Jenkins/p4groovy.html?Highlight=P4Groovy You could then specify the command line you need for the sync.
          Karl Wirth made changes -
          Labels New: P4_B
          Karl Wirth made changes -
          Assignee Original: Karl Wirth [ p4karl ]

          Jose Valverde added a comment -

          Hi p4karl .

          Thanks for you feedback,

          In the meanwhile, I'll try to sync my workspace as you've instructed!

          Jose Valverde added a comment - Hi p4karl . Thanks for you feedback, In the meanwhile, I'll try to sync my workspace as you've instructed!

          Jose Valverde added a comment -

          Hi p4karl,

          I'm trying to change my job to run a P4Groovy, and I've created an example as in the link you've shared, and i'm getting the following error:

           

          [Pipeline] End of Pipeline
          ERROR: P4: Task Exception: Invalid credentials
          

           

          This is my test code:

           

          node("my_node") {
              // Define workspace
              def ws = [$class: 'StreamWorkspaceImpl', 
              charset: 'none', format: 'jenkins-${JOB_NAME}', 
              pinHost: false, streamName: '//my_workspace']// Create object
              def p4 = p4 (credential: 'my_client', workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: 'my_workspace')))
             p4.run('sync','...')
          }
          

           

          Please note that "my_client" is the same using in other working jobs.

          Is there any additional configuration needed on my job, rather then what is on the shared link (de-select groovy sandbox) ?

           

          Thanks for the help!

           

          Jose Valverde added a comment - Hi p4karl , I'm trying to change my job to run a P4Groovy, and I've created an example as in the link you've shared, and i'm getting the following error:   [Pipeline] End of Pipeline ERROR: P4: Task Exception: Invalid credentials   This is my test code:   node( "my_node" ) { // Define workspace def ws = [$class: 'StreamWorkspaceImpl' , charset: 'none' , format: 'jenkins-${JOB_NAME}' , pinHost: false , streamName: ' //my_workspace' ]// Create object def p4 = p4 (credential: 'my_client' , workspace: manualSpec(charset: 'none' , cleanup: false , name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}' , pinHost: false , spec: clientSpec(allwrite: false , backup: true , changeView: '', clobber: true , compress: false , line: ' LOCAL ', locked: false , modtime: false , rmdir: false , serverID: ' ', streamName: ' ', type: ' WRITABLE ', view: ' my_workspace'))) p4.run( 'sync' , '...' ) }   Please note that "my_client" is the same using in other working jobs. Is there any additional configuration needed on my job, rather then what is on the shared link (de-select groovy sandbox) ?   Thanks for the help!  

          Karl Wirth added a comment -

          Hi citylife4,

          Sorry 'credential' is a typo. That should be your Jenkins credential not the workspace name. For example:

           def p4 = p4 (credential: 'myJenkinsCrentialName',workspace: ...
          

          Karl Wirth added a comment - Hi citylife4 , Sorry 'credential' is a typo. That should be your Jenkins credential not the workspace name. For example: def p4 = p4 (credential: 'myJenkinsCrentialName' ,workspace: ...

            p4karl Karl Wirth
            citylife4 Jose Valverde
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: