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

时间:2014-12-04 20:59:36

标签: jenkins jenkins-plugins cloudbees

我正在尝试使用CloudBees Folder插件和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'

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

我正在使用Jenkins 1.569和CloudBees Folders 4.7插件。

1 个答案:

答案 0 :(得分:4)

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'