ghprb-plugin
                                
                                
                                
                                    ghprb-plugin copied to clipboard
                            
                            
                            
                        Jenkinsfile env.BRANCHNAME returns null value
Hi,
I am trying to pass the branch name value from my Jenkins file to my groovy script. I tried to get the values as below but always getting empty value passed to the script. Is there any step i m missing? If I hardcode branchname then it works fine.
`node('master') { checkout scm functions = load 'pipeline-library/myfunctions.groovy'
    //def BRANCH_NAME=${env.BRANCH_NAME}
   //above one not working, passing null value
    //def BRANCH_NAME = sh(script: 'git rev-parse --abbrev-ref HEAD', returnStdout: true).trim()
   //above line not working, passing null value
   //def BRANCH_NAME ="develop"
   //working - passing value as "develop"
   myfunctions.MyGroovyScript("${BRANCH_NAME}")
} `
bump
+1
env.BRANCH_NAME not working on pipeline but it does on multibranch pipeline
+1
+1