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

Expose readonly type option for Manual workspaces

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: p4-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.30 // P4 Plugin 1.4.8
    • Similar Issues:

      Description

      According to https://www.perforce.com/perforce/r16.1/manuals/cmdref/p4_client.html , a client can be optionally set to type readonly to avoid automated builds fragmenting and bloating the server's db.have file. There are other benefits to using readonly-type clients - from what I understand the readonly client db files are not journaled so they won't be transmitted between replicas when they change.

      Using readonly clients for our Jenkins builds would likely solve an issue we have where one of our replicas in France gets hammered with nightly builds which makes our replica in the US completely unusable for an hour or more due to the db.have file being locked while our replica catches up with all of the pointless updates from the French replica.

        Attachments

          Activity

          Hide
          p4paul Paul Allen added a comment -

          Ready for release.

          Show
          p4paul Paul Allen added a comment - Ready for release.
          Hide
          p4paul Paul Allen added a comment -

          Released in 1.7.0

          Show
          p4paul Paul Allen added a comment - Released in 1.7.0
          Hide
          tr1z Tristan Lewis added a comment -

          Hey Paul Allen - I've gotten around to trying the new Type option for ManualWorkspaceImpl and while I can set it to READONLY in the job configuration, it doesn't seem to take affect when it writes out the workspace to perforce. To test this, I deleted the workspace associated with a job (since a workspace type cannot be changed after it's created), used the Jenkins UI to change the manual workspace type to READONLY, and then re-ran the job.

          The workspace that gets created with the new job configuration does not have a Type field, and I see no contents in my readonly clients directory on the p4d server. Am I doing something wrong?

          Show
          tr1z Tristan Lewis added a comment - Hey Paul Allen - I've gotten around to trying the new Type option for ManualWorkspaceImpl and while I can set it to READONLY in the job configuration, it doesn't seem to take affect when it writes out the workspace to perforce. To test this, I deleted the workspace associated with a job (since a workspace type cannot be changed after it's created), used the Jenkins UI to change the manual workspace type to READONLY, and then re-ran the job. The workspace that gets created with the new job configuration does not have a Type field, and I see no contents in my readonly clients directory on the p4d server. Am I doing something wrong?
          Hide
          p4paul Paul Allen added a comment -

          Here is a simple Pipeline script using 'readonly':

          node() {
              checkout([$class: 'PerforceScm', 
                  credential: 'graph1234', 
                  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: false, 
                          backup: false, 
                          clobber: false, 
                          compress: false, 
                          line: 'LOCAL', 
                          locked: false, 
                          modtime: false, 
                          rmdir: false, 
                          serverID: '', 
                          streamName: '//p4-perl/main', 
                          type: 'READONLY', 
                          view: '']
                      ]
                  ])
          }
          

          and the verified with:

          p4 client -o jenkins-achilles-pipeReadOnly
          
          Client:	jenkins-achilles-pipeReadOnly
          
          Update:	2017/06/08 14:02:58
          
          Access:	2017/06/08 14:02:58
          
          Owner:	p4jtestsuper
          
          Root:	/home/pallen/slave-mac/workspace/pipeReadOnly
          
          Options:	noallwrite clobber nocompress unlocked nomodtime normdir
          
          SubmitOptions:	submitunchanged
          
          LineEnd:	local
          
          Stream:	//p4-perl/main
          
          Type:	readonly
          
          View:
          	//p4-perl/main/... //jenkins-achilles-pipeReadOnly/...
          
          
          Show
          p4paul Paul Allen added a comment - Here is a simple Pipeline script using 'readonly': node() { checkout([$class: 'PerforceScm' , credential: 'graph1234' , 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: false , backup: false , clobber: false , compress: false , line: 'LOCAL' , locked: false , modtime: false , rmdir: false , serverID: '', streamName: ' //p4-perl/main' , type: 'READONLY' , view: ''] ] ]) } and the verified with: p4 client -o jenkins-achilles-pipeReadOnly Client: jenkins-achilles-pipeReadOnly Update: 2017/06/08 14:02:58 Access: 2017/06/08 14:02:58 Owner: p4jtestsuper Root: /home/pallen/slave-mac/workspace/pipeReadOnly Options: noallwrite clobber nocompress unlocked nomodtime normdir SubmitOptions: submitunchanged LineEnd: local Stream: //p4-perl/main Type: readonly View: //p4-perl/main/... //jenkins-achilles-pipeReadOnly/...
          Hide
          p4paul Paul Allen added a comment -

          I used a 2017.1 P4D and had set the 'client.readonly.dir' configurable:

          client.readonly.dir=clients.readonly
          
          Show
          p4paul Paul Allen added a comment - I used a 2017.1 P4D and had set the 'client.readonly.dir' configurable: client.readonly.dir=clients.readonly

            People

            • Assignee:
              p4paul Paul Allen
              Reporter:
              tr1z Tristan Lewis
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: