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

Cannot use 'WORKSPACE' variable when creating custom workspace to *modify* the auto-generated workspace

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None

      In short: We need to have "${WORKSPACE}_${Branch}" as the custom workspace where this simply adds the branch name (a parameter) to the existing auto-created workspace. This doesn't work as the auto-generated WORKSPACE variable has not been created yet as far as I can tell. Please can it be created before the attempt to resolve the workspace and if the "${WORKSPACE}" variable is detected in the declaration then the code follows the same path as for auto-generated workspaces?

      This is not the same as using say EXECUTOR_NUMBER in the workspace name in the custom workspace declaration as the auto-generated workspace uses the currently running 'instance' number of a job (where the node has multiple executors) so if you have restricted the number of instances of a job (e.g. "Throttle Concurrent Builds" plugin) then you only get up to the number of allowed instances of workspaces to be created. This is important as our workspaces are very big and consume lots of disk space - SSDs for speed, so space is relatively costly - and we have multiple branches which multiplies up this number even further!

      The reason for needing to modify the workspace comes from the Perforce plugin which has useful utility parameters 'P4CLEANWORKSPACE' and 'P4QUICKCLEANWORKSPACE'. However our branches exist within the same workspace directory so if these options are used then they completely blow away any other branch than the one specified. The obvious solution is to modify the workspace (as in the first paragraph above) but without the ability to modify the existing workspace we run into space issues.

      Hope I have made a somewhat complex issue clear . I have tried various workarounds (which feel more like hacks), none of which worked, but the best solution really is as described in this report I think. And this would be a useful addition to Jenkins anyway.

      Unless anyone can think of a way of doing this?

            Unassigned Unassigned
            prutherford Phil Rutherford
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: