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
CodePudding user response:
Solution
Use double quotes. Read about String interpolation in Groovy
zip zipFile: "test_${BUILDVERSION}.zip"