def props = readJSON file: 'dir/input.json'
assert props['attr1'] == 'One'
assert props.attr1 == 'One'
def props = readJSON text: '{ "key": "value" }'
assert props['key'] == 'value'
assert props.key == 'value'
def props = readJSON text: '[ "a", "b"]'
assert props[0] == 'a'
assert props[1] == 'b'
def props = readJSON text: '{ "key": null, "a": "b" }', returnPojo: true
assert props['key'] == null
props.each { key, value ->
echo "Walked through key $key and value $value"
}
依赖插件
https://plugins.jenkins.io/pipeline-utility-steps/#releases
https://updates.jenkins.io/download/plugins/snakeyaml-api/1.30.2-76.vc104f7ce9870/snakeyaml-api.hpi
参考文档
https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace
版权属于:区块链开发网
本文链接:www.zhugexiaojue.com/index.php/archives/1334.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!
,
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持一下吧