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

When using the SpecWorkspaceImpl workspaces are update twice every build

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: p4-plugin
    • Labels:
    • Environment:
      Docker
      CloudBees Jenkins Enterprise 2.121.1.2-rolling
      p4 plugin version: 1.8.9

    • Similar Issues:

      Description

      if you are using variables for the root or host properties in your SpecWorkspaceImpl spec file, the p4 plugin will update the workspace two times a build:

      Host property: If it isn't set in the spec file it will set it to '' (blank) and then it will update then set the host value on the client spec to the currently running node host name.

      Root property: If you are using a variable (e.g. ${WORKSPACE}) the root is first set to 'WORKSPACE' and then it is set to current workspace you have specified in your jenkinsfile (using the ws() task).

      Although everything still syncs correctly, over time this results in thousands of revisions on the same workspace that hasn't really changed. This can have a significant impact on the ability to backup the given perforce server.

      I think the whole client spec should be expanded/resolved before it "updates" the client spec. This should prevent the updating of a client spec on every build.

      diff of client spec:
      p4 diff2 //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31018 //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31019
      ==== //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31018 (text+C) - //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31019 (text+C) ==== content
      46a47,48
      > Host: DREUK-UT023
      >
      50c52
      < Root: WORKSPACE

      > Root: C:\JenkinsAgent\w\Dashing.HealthCheck-Ping\Tools\Prod

      d:\P4\EAUK\CM\DREUK>p4 diff2 //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31019 //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31020
      ==== //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31019 (text+C) - //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31020 (text+C) ==== content
      41c41
      < Update: 2018/11/07 10:41:35

      > Update: 2018/11/07 10:49:03
      43c43
      < Access: 2018/11/07 10:09:03

      > Access: 2018/11/07 10:41:35
      47,48d46
      < Host: DREUK-UT023
      <
      52c50
      < Root: C:\JenkinsAgent\w\Dashing.HealthCheck-Ping\Tools\Prod

      > Root: WORKSPACE

      d:\P4\EAUK\CM\DREUK>p4 diff2 //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31020 //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31021
      ==== //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31020 (text+C) - //spec/client/jenkins-DREUK-Prod-DREUK-UT023-Dashing.HealthCheck-Ping-configscripts.p4s#31021 (text+C) ==== content
      46a47,48
      > Host: DREUK-UT023
      >
      50c52
      < Root: WORKSPACE

      > Root: C:\JenkinsAgent\w\Dashing.HealthCheck-Ping\Tools\Prod

      I have attached an example file spec implementation
      I believe the following two classes are where all the work is done:

      • org\jenkinsci\plugins\p4\client\ClientHelper.java - public void setClient(Workspace workspace)
      • org\jenkinsci\plugins\p4\workspace\SpecWorkspaceImpl.java - public IClient setClient(IOptionsServer connection, String user)

        Attachments

          Issue Links

            Activity

            Hide
            peanderson peter anderson added a comment -

            Looking at the other JIRA it only talks about the "root" changing, nothing about the "host". Can you confirm that the flip-flopping of the "host" has also been fixed Paul Allen?

            Show
            peanderson peter anderson added a comment - Looking at the other JIRA it only talks about the "root" changing, nothing about the "host". Can you confirm that the flip-flopping of the "host" has also been fixed Paul Allen ?
            Hide
            p4paul Paul Allen added a comment -

            The fix in change: https://swarm.workshop.perforce.com/changes/24987 compares the client objects before updating the client spec; this should avoid the 'flip/flop' behaviour for fields like Host, Stream and Type.  Just running tests on Root as there may be some gaps, if all goes well there should be a patch release out soon.

            Show
            p4paul Paul Allen added a comment - The fix in change: https://swarm.workshop.perforce.com/changes/24987  compares the client objects before updating the client spec; this should avoid the 'flip/flop' behaviour for fields like Host, Stream and Type.  Just running tests on Root as there may be some gaps, if all goes well there should be a patch release out soon.

              People

              • Assignee:
                p4paul Paul Allen
                Reporter:
                peanderson peter anderson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: