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

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

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            contewit Brenden Conte created issue -
            xmiklis Mika Karjalainen added a comment - - edited

            Suspect this changed with branch-api-plugin update to version 1.11. I see we have workspaces stored to the ${Workspace Root Directory} in September but now all workspaces are created to ${JENKINS_HOME}/workspace.

            xmiklis Mika Karjalainen added a comment - - edited Suspect this changed with branch-api-plugin update to version 1.11. I see we have workspaces stored to the ${Workspace Root Directory} in September but now all workspaces are created to ${JENKINS_HOME}/workspace.
            contewit Brenden Conte made changes -
            Field Original Value New Value
            Component/s branch-api-plugin [ 18621 ]
            ahuntpindrop Alex Hunt made changes -
            Environment Windows server 2012 64 bit Windows server 2012 64 bit, Debian 8
            ahuntpindrop 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.

            ahuntpindrop 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.
            mjdetullio Matthew DeTullio made changes -
            Component/s multi-branch-project-plugin [ 21127 ]
            mjdetullio Matthew DeTullio made changes -
            Assignee Matthew DeTullio [ mjdetullio ] Stephen Connolly [ stephenconnolly ]
            stephenconnolly Stephen Connolly made changes -
            Labels scm-api-tidy-scrub
            stephenconnolly Stephen Connolly made changes -
            Component/s workflow-multibranch-plugin [ 21465 ]
            Component/s branch-api-plugin [ 18621 ]
            stephenconnolly Stephen Connolly made changes -
            Assignee Stephen Connolly [ stephenconnolly ] CloudBees Inc. [ cloudbees ]
            stephenconnolly Stephen Connolly made changes -
            Component/s branch-api-plugin [ 18621 ]
            stephenconnolly Stephen Connolly made changes -
            Labels scm-api-tidy-scrub scm-api-tidy

            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>
            
            xmiklis 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>
            stephenconnolly Stephen Connolly made changes -
            Component/s workflow-multibranch-plugin [ 21465 ]
            stephenconnolly 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
            recampbell Ryan Campbell made changes -
            Labels scm-api-tidy regression scm-api-tidy
            jglick Jesse Glick added a comment -

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

            jglick Jesse Glick added a comment - Possibly could use Jenkins.getRawWorkspaceDir() . Just beware JENKINS-21942 !
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-21942 [ JENKINS-21942 ]
            jglick 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.

            jglick 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.

            morganr 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.
            jglick 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.

            jglick 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.
            rsandell rsandell made changes -
            Assignee CloudBees Inc. [ cloudbees ] rsandell [ rsandell ]
            rsandell rsandell made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            rsandell rsandell made changes -
            Link This issue is related to JENKINS-34564 [ JENKINS-34564 ]
            rsandell rsandell made changes -
            Remote Link This issue links to "PR #98 (Web Link)" [ 16105 ]
            rsandell rsandell made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-39667 [ JENKINS-39667 ]
            jglick Jesse Glick added a comment -

            Alternate PR 103.

            jglick Jesse Glick added a comment - Alternate PR 103.
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 103 (Web Link)" [ 17117 ]
            jglick Jesse Glick made changes -
            Assignee rsandell [ rsandell ] Jesse Glick [ jglick ]

            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_issue_link 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_issue_link 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
            stephenconnolly Stephen Connolly made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            jamesdumay James Dumay made changes -
            Remote Link This issue links to "CloudBees Internal OSS-2059 (Web Link)" [ 18439 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved: