结合使用createItem远程API和CloudBees文件夹插件来创建嵌套的作业或子目录

Jef*_*f W 1 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' 
Run Code Online (Sandbox Code Playgroud)

作品。命令完成后,我在仪表板的顶层有了一个新创建的“ 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' 
Run Code Online (Sandbox Code Playgroud)

我收到“错误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'
Run Code Online (Sandbox Code Playgroud)

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

我正在将Jenkins 1.569与CloudBees Folders 4.7插件一起使用。

Jes*_*ick 5

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'
Run Code Online (Sandbox Code Playgroud)