我如何使用 api 更新 jenkins 作业 [英] How can i update a jenkins job using the api

查看:30
本文介绍了我如何使用 api 更新 jenkins 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用其 api 创建/更新 jenkins 作业,因为我所有的作业都使用其他脚本也使用的参数,并且我正在尝试集中脚本,因此当我在一个地方更改它时,更改反映在所有.

I have to create/update a jenkins job using its api because all of my jobs are using parameters which are also used by other scripts and I am trying to centralize the scripts so when i change it in one place, the change reflects in all.

目前,如果有人更改了脚本,他们还必须手动编辑 jenkins 作业的参数.

currently, if someone changes the script, they they also have to manually edit the parameters of the jenkins job as well.

我看到了用于创建作业的远程 API 示例,并且能够成功创建测试作业,但是除了删除并再次创建它之外,我如何编辑现有作业(这不是一个选项,因为我必须维护构建历史)).

I saw the example of the Remote API for creating jobs and was able to successfully create test jobs but how can i edit an existing job besides deleting it and creating it again(which isnt an option as i have to maintain the build history).

推荐答案

如果其他人也在寻找相同的答案,

in case anyone else is also looking for the same answer,

看起来解决方案要简单得多,您所要做的就是更新 config.xml 并将更新后的 config.xml 发布回 jenkins,您的作业就会更新.

It appears the solution is far easier, all you have to do is update the config.xml and post the updated config.xml back to jenkins and your job will be updated.

这篇关于我如何使用 api 更新 jenkins 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆