美文网首页
(高级)通过API 更改jenkins 的job 配置

(高级)通过API 更改jenkins 的job 配置

作者: devttao | 来源:发表于2018-12-20 17:19 被阅读0次

实际上这不属于jenkins 的高级 用法, 暂且放在这里_

获取当前配置

curl -X GET http://developer:developer@localhost:8080/job/test/config.xml -o mylocalconfig.xml

更改配置内容

mylocalconfig.xml 修改相应的配置项, 如参数增加一个选项:


image.png

or

# n;n; find the keywords and add one more line in the file
sed -i -e "/# Adjust #/{n;n;s|\$|\n              <string>NAME<\/string>|}" modifi.xml

推送更新更改后的配置

curl -X POST http://developer:developer@localhost:8080/job/test/config.xml --data-binary "@mymodifiedlocalconfig.xml"

注意: 一般情况下不建议这种方式直接更改jenkins 配置,万一改错conifg.xml,jenkins job 的配置就被破坏了,甚至jenkins整个挂掉。切记切记!
另: 备份很重要!_

相关文章

网友评论

      本文标题:(高级)通过API 更改jenkins 的job 配置

      本文链接:https://www.haomeiwen.com/subject/mhfukqtx.html