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

Mutibranch project plugin does not respect "Workspace Root Directory" global configuration

      The multibranch project plugin always creates the workspaces to build the branches in "${JENKINS_HOME}/jobs/your-multi-branch-project/branches/${branchNameEncoded}/workspace", however our configuration has the workspaces on a different drive with much more space, so WORKSPACE is not on the same drive as JENKINS_HOME.

      This is configured in the global config->Workspace Root Directory (under advanced below Home Directory).

      Please use "${Workspace Root Directory}/${branchNameEncoded}/workspace" or something similar instead.

          [JENKINS-38837] Mutibranch project plugin does not respect "Workspace Root Directory" global configuration

          Alex Hunt added a comment -

          I can confirm that this issue is very much still in affect on Jenkins 2.33 with branch-api plugin 1.11.1.

          We have the following plugins installed:

          ace-editor:1.1
          active-directory:2.0
          ant:1.4
          antisamy-markup-formatter:1.5
          artifactory:2.8.0
          authentication-tokens:1.3
          aws-credentials:1.16
          aws-java-sdk:1.11.37
          bouncycastle-api:2.16.0
          branch-api:1.11.1
          build-timeout:1.17.1
          cloudbees-folder:5.13
          cobertura:1.9.8
          conditional-buildstep:1.3.5
          config-file-provider:2.13
          credentials:2.1.8
          credentials-binding:1.10
          cucumber-testresult-plugin:0.9.7
          datadog:0.5.5
          display-url-api:0.5
          docker-commons:1.5
          docker-custom-build-environment:1.6.5
          docker-workflow:1.9
          durable-task:1.12
          ec2:1.36
          email-ext:2.52
          embeddable-build-status:1.9
          envinject:1.93.1
          external-monitor-job:1.6
          git:3.0.0
          git-client:2.1.0
          github:1.22.4
          github-api:1.79
          github-branch-source:1.10
          github-organization-folder:1.5
          git-server:1.7
          global-build-stats:1.4
          gradle:1.25
          handlebars:1.1.1
          htmlpublisher:1.11
          icon-shim:2.0.3
          ivy:1.26
          jackson2-api:2.7.3
          javadoc:1.4
          jquery-detached:1.2.1
          junit:1.19
          ldap:1.13
          mailer:1.18
          mapdb-api:1.0.9.0
          matrix-auth:1.4
          matrix-project:1.7.1
          maven-plugin:2.14
          momentjs:1.1.1
          node-iterator-api:1.5
          pam-auth:1.3
          parallel-test-executor:1.9
          parameterized-trigger:2.32
          pipeline-build-step:2.3
          pipeline-graph-analysis:1.2
          pipeline-input-step:2.3
          pipeline-milestone-step:1.1
          pipeline-rest-api:2.2
          pipeline-stage-step:2.2
          pipeline-stage-view:2.2
          plain-credentials:1.3
          resource-disposer:0.3
          run-condition:1.0
          scm-api:1.3
          script-security:1.24
          slack:2.0.1
          ssh-agent:1.13
          ssh-credentials:1.12
          ssh-slaves:1.11
          structs:1.5
          subversion:2.7.1
          swarm:2.2
          timestamper:1.8.7
          token-macro:2.0
          windows-slaves:1.2
          workflow-aggregator:2.4
          workflow-api:2.6
          workflow-basic-steps:2.3
          workflow-cps:2.23
          workflow-cps-global-lib:2.4
          workflow-durable-task-step:2.5
          workflow-job:2.8
          workflow-multibranch:2.9
          workflow-scm-step:2.2
          workflow-step-api:2.5
          workflow-support:2.10
          ws-cleanup:0.32
          

          Jenkins master is running in a docker container based on the official jenkinsci-docker. The Jenkins home is on NFS passed in via a docker volume, and this causes very slow checkouts and timeouts for some repositories. Not being able to change the workspace root directory is a huge blocker for us, as it is the difference between a repo timing out after 10 minutes (Jenkins being totally unusable), and a repo checking out in just a few seconds.

          Alex Hunt added a comment - I can confirm that this issue is very much still in affect on Jenkins 2.33 with branch-api plugin 1.11.1. We have the following plugins installed: ace-editor:1.1 active-directory:2.0 ant:1.4 antisamy-markup-formatter:1.5 artifactory:2.8.0 authentication-tokens:1.3 aws-credentials:1.16 aws-java-sdk:1.11.37 bouncycastle-api:2.16.0 branch-api:1.11.1 build-timeout:1.17.1 cloudbees-folder:5.13 cobertura:1.9.8 conditional-buildstep:1.3.5 config-file-provider:2.13 credentials:2.1.8 credentials-binding:1.10 cucumber-testresult-plugin:0.9.7 datadog:0.5.5 display-url-api:0.5 docker-commons:1.5 docker-custom-build-environment:1.6.5 docker-workflow:1.9 durable-task:1.12 ec2:1.36 email-ext:2.52 embeddable-build-status:1.9 envinject:1.93.1 external-monitor-job:1.6 git:3.0.0 git-client:2.1.0 github:1.22.4 github-api:1.79 github-branch-source:1.10 github-organization-folder:1.5 git-server:1.7 global-build-stats:1.4 gradle:1.25 handlebars:1.1.1 htmlpublisher:1.11 icon-shim:2.0.3 ivy:1.26 jackson2-api:2.7.3 javadoc:1.4 jquery-detached:1.2.1 junit:1.19 ldap:1.13 mailer:1.18 mapdb-api:1.0.9.0 matrix-auth:1.4 matrix-project:1.7.1 maven-plugin:2.14 momentjs:1.1.1 node-iterator-api:1.5 pam-auth:1.3 parallel-test-executor:1.9 parameterized-trigger:2.32 pipeline-build-step:2.3 pipeline-graph-analysis:1.2 pipeline-input-step:2.3 pipeline-milestone-step:1.1 pipeline-rest-api:2.2 pipeline-stage-step:2.2 pipeline-stage-view:2.2 plain-credentials:1.3 resource-disposer:0.3 run-condition:1.0 scm-api:1.3 script-security:1.24 slack:2.0.1 ssh-agent:1.13 ssh-credentials:1.12 ssh-slaves:1.11 structs:1.5 subversion:2.7.1 swarm:2.2 timestamper:1.8.7 token-macro:2.0 windows-slaves:1.2 workflow-aggregator:2.4 workflow-api:2.6 workflow-basic-steps:2.3 workflow-cps:2.23 workflow-cps-global-lib:2.4 workflow-durable-task-step:2.5 workflow-job:2.8 workflow-multibranch:2.9 workflow-scm-step:2.2 workflow-step-api:2.5 workflow-support:2.10 ws-cleanup:0.32 Jenkins master is running in a docker container based on the official jenkinsci-docker. The Jenkins home is on NFS passed in via a docker volume, and this causes very slow checkouts and timeouts for some repositories. Not being able to change the workspace root directory is a huge blocker for us, as it is the difference between a repo timing out after 10 minutes (Jenkins being totally unusable), and a repo checking out in just a few seconds.

          Reproduced with Jenkins 2.32.2 and branch-api-plugin 2.0.7.

          I have workspce root directory configured to a mounted nfs disk

          /jenkins/ws/${ITEM_FULLNAME}

          but running a build produces this

          Running on master in /var/lib/jenkins/workspace/<project-HASH>
          

          Mika Karjalainen added a comment - Reproduced with Jenkins 2.32.2 and branch-api-plugin 2.0.7. I have workspce root directory configured to a mounted nfs disk /jenkins/ws/${ITEM_FULLNAME} but running a build produces this Running on master in /var/lib/jenkins/workspace/<project-HASH>

          Stephen Connolly added a comment - https://github.com/jenkinsci/branch-api-plugin/blob/ec03b429c21e5035b652b624b29b3dee79ffef8a/src/main/java/jenkins/branch/WorkspaceLocatorImpl.java#L71 is where the setting is being ignored CC jglick

          Jesse Glick added a comment -

          Possibly could use Jenkins.getRawWorkspaceDir(). Just beware JENKINS-21942!

          Jesse Glick added a comment - Possibly could use Jenkins.getRawWorkspaceDir() . Just beware JENKINS-21942 !

          Jesse Glick added a comment -

          BTW this is only an issue if you have nonzero executors on master, which you should not—use agents instead.

          Jesse Glick added a comment - BTW this is only an issue if you have nonzero executors on master, which you should not—use agents instead.

          IIUC the a master with zero executors will still retrieve the entire repository into the master's workspace directories for each Jenkinsfile it wants to read. I'm seeing this with Jenkins 2.19.4, Branch API Plugin 1.11.1, Git plugin 3.0.1.

          Richard Morgan added a comment - IIUC the a master with zero executors will still retrieve the entire repository into the master's workspace directories for each Jenkinsfile it wants to read. I'm seeing this with Jenkins 2.19.4, Branch API Plugin 1.11.1, Git plugin 3.0.1.

          Jesse Glick added a comment -

          will still retrieve the entire repository into the master's workspace directories for each Jenkinsfile it wants to read

          Not if you update workflow-multibranch and meet the conditions mentioned in its release notes. Anyway that is off topic here.

          Jesse Glick added a comment - will still retrieve the entire repository into the master's workspace directories for each Jenkinsfile it wants to read Not if you update workflow-multibranch and meet the conditions mentioned in its release notes. Anyway that is off topic here.

          Jesse Glick added a comment -

          Alternate PR 103.

          Jesse Glick added a comment - Alternate PR 103.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/jenkins/branch/WorkspaceLocatorImpl.java
          src/test/java/jenkins/branch/WorkspaceLocatorImplTest.java
          http://jenkins-ci.org/commit/branch-api-plugin/4bf7c68f06cf3b2c39b553e686f6e828630ed593
          Log:
          JENKINS-38837 Adjust multibranch workspace calculation on master to match customized workspaceDir.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/jenkins/branch/WorkspaceLocatorImpl.java src/test/java/jenkins/branch/WorkspaceLocatorImplTest.java http://jenkins-ci.org/commit/branch-api-plugin/4bf7c68f06cf3b2c39b553e686f6e828630ed593 Log: JENKINS-38837 Adjust multibranch workspace calculation on master to match customized workspaceDir.

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/branch/WorkspaceLocatorImpl.java
          src/test/java/jenkins/branch/WorkspaceLocatorImplTest.java
          http://jenkins-ci.org/commit/branch-api-plugin/16108110bf6e508ccce5bc5102688f35c5bc4287
          Log:
          Merge pull request #103 from jglick/customMasterDir-JENKINS-38837

          JENKINS-38837 Handle custom master workspace directory

          Compare: https://github.com/jenkinsci/branch-api-plugin/compare/bb1f94f98f51...16108110bf6e

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/branch/WorkspaceLocatorImpl.java src/test/java/jenkins/branch/WorkspaceLocatorImplTest.java http://jenkins-ci.org/commit/branch-api-plugin/16108110bf6e508ccce5bc5102688f35c5bc4287 Log: Merge pull request #103 from jglick/customMasterDir- JENKINS-38837 JENKINS-38837 Handle custom master workspace directory Compare: https://github.com/jenkinsci/branch-api-plugin/compare/bb1f94f98f51...16108110bf6e

            jglick Jesse Glick
            contewit Brenden Conte
            Votes:
            12 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: