-
Bug
-
Resolution: Fixed
-
Minor
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!
[JENKINS-63972] Environment Variable String Interpolation for Setting Custom Workspace
Description |
Original:
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! |
New:
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! |
Description |
Original:
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! |
New:
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! |
Description |
Original:
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! |
New:
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! |
Resolution | New: Fixed [ 1 ] | |
Status | Original: Open [ 1 ] | New: Fixed but Unreleased [ 10203 ] |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Closed [ 6 ] |
Does this not work with double quoted strings i.e "" instead of ''