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

When using the SpecWorkspaceImpl workspaces are update twice every build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • p4-plugin
    • Docker
      CloudBees Jenkins Enterprise 2.121.1.2-rolling
      p4 plugin version: 1.8.9

      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)

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

              Created:
              Updated:
              Resolved: