且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jenkins-pipeline 从 groovy 中的属性文件中提取和设置变量

更新时间:2023-11-01 15:46:28

已解决:

def content = readFile 'gradle.properties'

Properties properties = new Properties()
InputStream is = new ByteArrayInputStream(content.getBytes());
properties.load(is)

def runtimeString = 'SERVICE_VERSION_MINOR'
echo properties."$runtimeString"
SERVICE_VERSION_MINOR = properties."$runtimeString"
echo SERVICE_VERSION_MINOR