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

Allow custom workspaces in declarative pipeline

    Details

    • Similar Issues:

      Description

      The declarative pipeline syntax does not appear to allow for custom workspace roots.

      Can this configuration be added to either the agent or options blocks?

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            There will be once https://github.com/jenkins-infra/jenkins.io/pull/715 gets merged. =)

            Show
            abayer Andrew Bayer added a comment - There will be once https://github.com/jenkins-infra/jenkins.io/pull/715  gets merged. =)
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            content/doc/book/pipeline/syntax.adoc
            http://jenkins-ci.org/commit/jenkins.io/57344406ba57e861ae0edc0f6deecb977c7dd06c
            Log:
            JENKINS-41118 - add customWorkspace docs

            Also adding `node` `agent` type (which is just an alias for `label`,
            but hey) and the `reuseNode` option for `docker` and `dockerfile`,
            which we should have added earlier but forgot. Whoops.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: content/doc/book/pipeline/syntax.adoc http://jenkins-ci.org/commit/jenkins.io/57344406ba57e861ae0edc0f6deecb977c7dd06c Log: JENKINS-41118 - add customWorkspace docs Also adding `node` `agent` type (which is just an alias for `label`, but hey) and the `reuseNode` option for `docker` and `dockerfile`, which we should have added earlier but forgot. Whoops.
            Hide
            eckki RJE added a comment -

            This worked for me since version 1.1:

            pipeline {
                agent {
                    label {
                        label ""
                        customWorkspace "C:/work/${BRANCH_NAME}"
                    }
                }
                stages {
                    stage("foo") {
                        steps {
                            echo "Workspace dir is ${pwd()}"
                        }
                    }
                }
            }
            

            Thanks to Andrew Bayer

            Show
            eckki RJE added a comment - This worked for me since version 1.1: pipeline {     agent {         label {             label ""             customWorkspace "C:/work/${BRANCH_NAME}"         }     }     stages {         stage( "foo" ) {             steps {                 echo "Workspace dir is ${pwd()}"             }         }     } } Thanks to Andrew Bayer
            Hide
            akmjenkins ASHOK MOHANTY added a comment -

            Quick question.. We are using Jenkins 2.121.3 (& planning to upgrade to 2.164.3). Can I use custom workspace in Multibranch/Script pipeline !? 

            Show
            akmjenkins ASHOK MOHANTY added a comment - Quick question.. We are using Jenkins 2.121.3 (& planning to upgrade to 2.164.3). Can I use custom workspace in Multibranch/Script pipeline !? 
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                ssutherland Sean Sutherland
              • Votes:
                3 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: