在詹金斯中动态创建工作 [英] Create Job Dynamically in Jenkins
问题描述
我在具有配置的jenkins
中有一份工作,然后,通过/cli
中的jenkins
API,我可以使用工作的xml
结构来get-job
(API方法),然后我可以<jenkins
中的c5>(API方法),后跟xml.
I have a job in jenkins
with a configuration, then, with the jenkins
API in /cli
i can get-job
(API method) with an xml
structure of my job and then i can create-job
(API method) in jenkins
with the followed xml.
?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@2.2.7">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://username:password@bitbucket.org/repoowner/project.git</url>
<credentialsId>550e8400-e29b-41d4-a716-446655440000</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
....
即使我给此url
标记credentialsId
标签中给出了UUID.
Even if i give this url
tag "https://username:password@bitbucket.org/repoowner/project.git" jenkins needs authentication to work, so in credentialsId
tag jenkins give an UUID.
我希望能够由具有给定URL的外部应用程序动态创建作业,格式为"
I want to be able to create a job dynamically by an external application with a given URL in this format "https://username:password@bitbucket.org/repoowner/project.git".
怎么办?
谢谢.
推荐答案
实际上,我只是在bitbucket
中创建一个通用用户即可解决该问题,然后UUID
其始终相同,我可以复制并粘贴该UUID到其他project.xml
文件.
Actually i solve the problem just creating an generic user in bitbucket
, then the UUID
its always the same and i can just copy and paste that UUID to the others project.xml
files.
这篇关于在詹金斯中动态创建工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!