Issue
I have a variable, set as global environment, which outputs the timestamp.
echo "Current build version: ${BUILDVERSION}"
Current build version: 20211117-114343
Now I want to add this value to zip step for setting the zip file name and I check the content of the zip file.
zip zipFile: 'test_${BUILDVERSION}.zip'
sh 'zipinfo -1 test_${BUILDVERSION}.zip'
ZIP is not created properly: test_${BUILDVERSION}.zip
while zipinfo takes this value properly. zipinfo -1 test_20211117-114343.zip
Can you please assist what I do wrong? Thanks
Solution
Solution
Use double quotes. Read about String interpolation in Groovy
zip zipFile: "test_${BUILDVERSION}.zip"
Answered By - Chris Maggiulli
Answer Checked By - Willingham (JavaFixing Volunteer)