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

Setting workspace type to 'READONLY' doesn't work with servers running < 2017.1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin
    • P4 Plugin 1.8.9
      p4 server 2016.2
      Jenkins Enterprise 2.89.4.2-rolling

      I’m trying to implement readonly workspaces on one of our servers, which is running 2016.2. Readonly workspaces were introduced in 2015.2, so as expected, I can create them manually. However, if I go through the plugin, the workspace type is blank. I’ve uncovered this is because of a couple of if statements that restrict setting workspace type to server versions 2017.1 or later:

       

      In src\main\java\org\jenkinsci\plugins\p4\workspace\ManualWorkspaceImpl.java

      (Line 112)

      if (connection.getServerVersionNumber() >= 20171) {

             WorkspaceSpecType type = parseClientType(getSpec().getType());

             implClient.setType(type.getId());

      }

      [...]

      (Line 149)

      if (connection.getServerVersionNumber() >= 20171) {

             WorkspaceSpecType type = parseClientType(getSpec().getType());

             [...]

      }

       

      I created a custom version of the plugin that replaces 20171 in both if statements with 20162, and everything works as expected – workspaces created through the plugin are correctly set as ‘READONLY’.

       

      The changes were added in this commit: https://github.com/jenkinsci/p4-plugin/commit/91e3a3c8284d2bb84061f1afe2d16f63aeb95ee7 for JENKINS-39753

            Unassigned Unassigned
            aaronling Aaron Ling
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: