Why does this script variable keep showing as "null"?
0
votes
1
answer
153
views
I have the following script:
def String Service_version = sh "cd ./projects/onehome && pwd && cat package.json | grep version"
echo "Service_Version_update: $Service_version"
echo "My_Version is : ${Service_version}"
The output is:
cd ./projects/onehome
13:47:43 + pwd
13:47:43 /home/jenkins/agent/workspace/_apps_onehome_feature-AOTF-11540/projects/onehome
13:47:43 + cat package.json
13:47:43 + grep version
13:47:43 "version": "1.0.400",
13:47:43 [Pipeline] echo
13:47:43 Service_Version_update: null
13:47:43 [Pipeline] echo
13:47:43 My_Version is : null
Why is ${Service_version}
printed as null
?
Asked by Jenber Nurye
(1 rep)
Feb 28, 2024, 09:19 PM
Last activity: Mar 1, 2024, 12:30 PM
Last activity: Mar 1, 2024, 12:30 PM