将createItem远程API与CloudBees文件夹插件一起使用,以创建嵌套作业或子目录(Using createItem remote API with CloudBees folder pl

编程入门 行业动态 更新时间:2024-10-12 20:26:14
将createItem远程API与CloudBees文件夹插件一起使用,以创建嵌套作业或子目录(Using createItem remote API with CloudBees folder plugin to create nested jobs or subdirectories)

我正在尝试使用CloudBees文件夹插件和Jenkins远程API创建镜像我的SVN存储库结构的嵌套目录和作业。

对于子目录(假设我已将config.xml复制到我的CWD):

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/createItem?name=foo'

作品。 命令完成后,我在仪表板的顶层创建了一个新创建的“foo”文件夹。 但是,当我尝试:

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/createItem?name=foo/bar'

我收到“错误400:错误请求”。 我也尝试用“name = / foo / bar”,“name =%2Ffoo%2Fbar”和“name = foo%2Fbar”代替,所有结果都相同。

同样,当使用createItem / from / mode / name API复制内部文件夹时,我得到了类似的结果:

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/createItem?name=foo/bar&mode=copy&from=foo'

我发现这非常不寻常,因为 - 通过Web界面 - 我可以轻松地移动,复制和创建嵌套目录和作业。

我使用Jenkins 1.569和CloudBees文件夹4.7插件。

I am attempting to create nested directories and jobs mirroring the structure of my SVN repository using the CloudBees Folder plugin and Jenkins remote API.

For a subdirectory (assume I've copied the config.xml to my CWD):

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/createItem?name=foo'

works. When the command completes, I have a newly created "foo" folder in the top level of my dashboard. However when I try:

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/createItem?name=foo/bar'

I get a "ERROR 400: Bad Request". I've also tried substituting "name=/foo/bar", "name=%2Ffoo%2Fbar", and "name=foo%2Fbar", all with the same results.

Likewise, I get a similar result when using the createItem/from/mode/name API to copy internal folders:

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/createItem?name=foo/bar&mode=copy&from=foo'

I find this very unusual since - through the web interface - I can easily move, copy, and create nested directories and jobs.

I am using Jenkins 1.569 with the CloudBees Folders 4.7 plugin.

最满意答案

name可能只是一个简单的名称。 您要查找的端点位于文件夹上,而不是根级别。 从而

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/job/foo/createItem?name=bar'

name may only be a simple name. The endpoint you are looking for is on the folder, not at root level. Thus

wget --no-proxy --auth-no-challenge --http-user=username --ask-password --header="Content-Type: application/xml" --post-file="dconfig.xml" 'http://ci.mycompany.com/jenkins/job/foo/createItem?name=bar'

更多推荐

本文发布于:2023-07-15 05:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1110765.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业   嵌套   子目录   文件夹   插件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!