Jenkins Pipeline - 从远程 git url 读取属性



我有一个位于 git 项目中的属性文件。在构建单独的项目时,我想读取此属性文件以提取一些常见配置。

readProperties 仅允许从当前工作区加载文件。

如何从管道中的其他 git 项目中读取属性文件。

您可以克隆存储库/仅下载属性文件:

node() {
stage("Clone repo") {
git url: "https://github.com/ozlevka/go-envinronment.git"
//fileDownloadOperation url: "https://raw.githubusercontent.com/ozlevka/go-envinronment/master/bbb.properties"
}
stage("Read properies") 
{
def props = readProperties  file: './bbb.properties'
for (def key in props.keySet())
{
println "key = ${key}, value = ${props[key]}"
}
}
}

readProperties、git 和 fileDownloadOperation 的文档

最新更新