在詹金斯中动态创建工作 [英] Create Job Dynamically in Jenkins

查看:100
本文介绍了在詹金斯中动态创建工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在具有配置的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标记https://用户名:password @ bitbucket.org/repoowner/project.git " jenkins需要进行身份验证才能工作,因此jenkins在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屋!

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