Jenkins 仅回显环境变量的名称,而不是实际值

问题描述 投票:0回答:1
Started by user unknown or anonymous
Running as SYSTEM
Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\test
[test] $ cmd /c call C:\Windows\TEMP\jenkins7973539064156672133.bat

C:\ProgramData\Jenkins\.jenkins\workspace\test>echo Hello 
Hello

C:\ProgramData\Jenkins\.jenkins\workspace\test>echo ${BUILD_ID} 
${BUILD_ID}

C:\ProgramData\Jenkins\.jenkins\workspace\test>exit 0 
Finished: SUCCESS

可以看到,构建成功了,但是环境变量“BUILD_ID”值没有显示。

jenkins
1个回答
0
投票

在批处理脚本中,您需要使用

%BUILD_ID%
语法

© www.soinside.com 2019 - 2024. All rights reserved.