So I have a groovy script like this-
def BRANCH_REV = sh script: "svn info \$url | grep 'Last Changed Rev' | awk '{ print \$4; }'", returnStdout: true , trim: true
println "ccsmp - downstream testing for: $BRANCH_REV"
This script is suppose to fetch the last revision number and put that value in a variable called "BRANCH_REV" and second line is suppose to print it. But I keep getting null value, my console output looks like this-
[branches%2Ffeatures%2Fcre40_jenkins] Running shell script
+ svn info
+ grep 'Last Changed Rev'
+ awk '{ print $4; }'
23401 <-- It is printing the revision number here
[Pipeline] echo
ccsmp - downstream testing for: 0 <-- but when I try to print the $BRANCH_REV, it prints out 0
[Pipeline] sh
[branches%2Ffeatures%2Fcre40_jenkins] Running shell script
+ echo 0
0 <-- same thing happens when I try to echo $BRANCH_REV