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

Environment Variable String Interpolation for Setting Custom Workspace

XMLWordPrintable

      I am using a multibranch pipeline in Jenkins and I need to set the name of the custom workspace directory dynamically based on the branch name. When I define the custom workspace for the pipeline, I attempt to access the environment variable that contains the branch name as follows:

      pipeline {

        agent {

          node {

            label 'master'

            customWorkspace 'some/path/${BRANCH_NAME}'

       

      However, during git init of the workspace, the string interpolation does not happen. Instead of inserting whatever the branch name is into the string, it tries to set the workspace name as '${BRANCH_NAME}' without interpolating the branch name variable. I'm not sure if this is a mistake on my end or if it's a bug, so feel free to close if it's intended behavior. Thanks!

            Unassigned Unassigned
            shenoyprath Prathamesh Shenoy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: