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

new option to delete perforce client view & workspace on job deletion

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin
    • O/S: RedHat Enterprise Linux Server 6.4 (Santiago)
      JRE: Java(TM) SE Runtime Environment 1.8.0_60-b27
      p4-plugin: 1.3.5
      running jenkins directly

      Could we please have two checkboxes on the options for the perforce plugin for a job. One would be 'delete client on job deletion' and the other would be 'delete client root on job deletion'.

      The first would delete the client workspace in Jenkins ie 'p4 client -d <ws_name>'

      The second would delete the client workspace root directory ie all the checked-out files.

      Perhaps the global plugin configuration could have two further checkboxes so that these could default to 'on'?

      Having this feature would facilitate admin on our jenkins servers.

      I hope this feature is seen as potentially useful to others.

          [JENKINS-32454] new option to delete perforce client view & workspace on job deletion

          Paul Allen added a comment -

          The two checkboxes may need to be global (under the Perforce configuration page not the Job page).

          It would seem logical to have a common behaviour for workspace cleanup, rather than setting at the time you create the Jenkins Job?

          Still I would need to find out how to hook into the Jenkins Job deletion event.

          Paul Allen added a comment - The two checkboxes may need to be global (under the Perforce configuration page not the Job page). It would seem logical to have a common behaviour for workspace cleanup, rather than setting at the time you create the Jenkins Job? Still I would need to find out how to hook into the Jenkins Job deletion event.

          Patrick Byrne added a comment -

          That seems entirely reasonable to me: our many users are not going to bother setting checkboxes themselves and from my POV it would be much better to manage this centrally.

          Thanks for your attention.

          Patrick Byrne added a comment - That seems entirely reasonable to me: our many users are not going to bother setting checkboxes themselves and from my POV it would be much better to manage this centrally. Thanks for your attention.

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java
          src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java
          src/main/resources/org/jenkinsci/plugins/p4/PerforceScm/global.jelly
          http://jenkins-ci.org/commit/p4-plugin/55480ee7307e04f0a59f7f4a07dec865a0aa5b1a
          Log:
          Delete client workspace and files on a delete Jenkins Job

          Global Perforce options for delete files and/or delete client.
          JENKINS-32454

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java src/main/resources/org/jenkinsci/plugins/p4/PerforceScm/global.jelly http://jenkins-ci.org/commit/p4-plugin/55480ee7307e04f0a59f7f4a07dec865a0aa5b1a Log: Delete client workspace and files on a delete Jenkins Job Global Perforce options for delete files and/or delete client. JENKINS-32454

          This change does not appear to be deleting the workspace files (it is only deleting the perforce client) even though we have both checkboxes in the global configuration ticked.
          We do have a custom "Workspace Root Directory" set in the advanced global configuration. Could that be the reason why it does not work?

          Andrew Barnish added a comment - This change does not appear to be deleting the workspace files (it is only deleting the perforce client) even though we have both checkboxes in the global configuration ticked. We do have a custom "Workspace Root Directory" set in the advanced global configuration. Could that be the reason why it does not work?

          Paul Allen added a comment -

          I didn't consider a Custom Workspace Directory; however Perforce should unsync the versioned files (p4 sync #0). The object files and other build artifacts should get remove by Jenkins. Do any files get removed?

          With your custom Workspace, does the 'Root' field in the Client spec point to the correct location?

          If you could include a 'p4 client -o <workspace_name>' output and any logs from Jenkins it would give me a head start.

          Thanks,
          Paul

          Paul Allen added a comment - I didn't consider a Custom Workspace Directory; however Perforce should unsync the versioned files (p4 sync #0). The object files and other build artifacts should get remove by Jenkins. Do any files get removed? With your custom Workspace, does the 'Root' field in the Client spec point to the correct location? If you could include a 'p4 client -o <workspace_name>' output and any logs from Jenkins it would give me a head start. Thanks, Paul

          Paul Allen added a comment -

          Dan just reminded me that it is fixed in the snapshot 1.3.7 release.
          https://issues.jenkins-ci.org/browse/JENKINS-24003
          I'll try and get the release out soon.

          Paul Allen added a comment - Dan just reminded me that it is fixed in the snapshot 1.3.7 release. https://issues.jenkins-ci.org/browse/JENKINS-24003 I'll try and get the release out soon.

          Thanks for your comments. It sounds like 1.3.7 will work and we will give that a try.

          FYI we were not using a the "custom workspace" option in the job configuration.
          The option I was referring to is in the global jenkins configuration "Workspace Root Directory" which is hidden under one of the advanced buttons at the top. It allows us to use a separate disk for the workspaces which are very large in comparison to the jenkins global+job configuration files.

          Andrew Barnish added a comment - Thanks for your comments. It sounds like 1.3.7 will work and we will give that a try. FYI we were not using a the "custom workspace" option in the job configuration. The option I was referring to is in the global jenkins configuration "Workspace Root Directory" which is hidden under one of the advanced buttons at the top. It allows us to use a separate disk for the workspaces which are very large in comparison to the jenkins global+job configuration files.

            p4paul Paul Allen
            pjlbyrne Patrick Byrne
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: