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

Perforce "Workspace Name Format" reset to literal

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Critical Critical
    • p4-plugin
    • Jenkins 2.89.2
      P4 Plugin 1.8.5
      Java: 1.8.0_51-b31 (Oracle, 64-bit)
      Master on RedHat Enterprise Linux 6.6 x86_64.
      Perforce Server version: P4D/LINUX26X86_64/2017.1/1545029 (2017/08/16)

      When configuring a Pipeline project with source from Perforce, it is required to set a "Workspace Name Format" as a template which can be used to generate per-node, per-executor workspace names required by Perforce.

      The default value for this field is adequate and we have not felt the need to change it:

      jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}

      Furthermore the field requires that the value contains at least one substitution variable to be accepted.

      I recently noticed that our project's workspace name formats had changed to literal values such as:

      jenkinsTemp-87602970-2871-43c1-9759-0b16964ffa42

      Which does not match any expansion of the original name format.

      This change also corresponds to issues recently observed whereby developers have stopped getting emails on failed builds (which was previously working).  In fact, even though builds are triggered by SCM changes, the associated change list is empty.

      We presume that this is a consequence of the Jenkins build now using the same workspace name for different build nodes and executors – I believe that Perforce frowns on such things.

      Having changed all projects back to the default template on Friday evening, looking again today and every project which has been rebuilt since then once again has a literal value in place of the template.

      Light weight checkout?

      Since this wasn't happening before, we look for something that has changed...

      The most likely candidate is that all projects were recently switched to using "Lightweight Checkout" to obtain the Jenkinsfile – this capability became supported by P4 Plugin with release 1.8.4.  This mechanism saves a lot (in our case) of disk space by avoiding the need for an additional workspace sync just to get the Jenkinsfile.

      This would also be in line with the literal workspace name appearing in project configurations not being related to the original template format.

      Hypothesis

      P4 Plugin light weight checkout of the Jenkins file is overwriting the workspace name template for projects with the literal workspace name used during the lightweight checkout, and rendering the project incompatible with Perforce.

      Scenario

      Our builds are principle C/C++ code built using a makefile, driven by a script which sets the variables as appropriate to the build host and target.

      Each project interacts with Perforce as follows:

      1. A template workspace defined in Perforce.
      2. A Jenkinsfile from Perforce in the project's home directory – using lightweight checkout.
      3. A Jenkins extension library also held in Perforce is loaded by default.
      4. The project sources from Perforce as defined by the template workspace.

      This has been the same for a while now, and the recent change of enabling lightweight checkout on the Jenkinsfile (2) seems the most likely candidate for triggering the bug.


      Attached:

      • Pipeline configuration with corrupted "Workspace Name Format".

            p4karl Karl Wirth
            simon_watts Simon Watts
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: