I\'m trying to get the name of my branch for a jenkins groovy script. I cannot get the current branch name. I try the following:
stage(\'Check out code\') ch
From a simple pipeline you can use the following script:
\\... stage('Test') { steps { script { branchName = sh(label: 'getBranchName', returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() println branchName } } } \\...