我可以从Jenkins触发Azure DevOps构建吗?

时间:2019-04-11 10:08:39

标签: azure jenkins build azure-devops continuous-integration

我们使用Jenkins作为构建协调器,并且只是在针对特定项目使用Azure DevOps。无论是从git自动触发还是手动触发,我们的构建都能正常运行,从Git中提取代码并创建所需的工件。

不过,我仍然希望Jenkins成为协调员,以便我们的渠道对于不在我们团队中的人更加明显。

关于从DevOps触发Jenkins的信息很多,但是我还没有找到任何能满足我们需求的东西。有可能吗,请分享一下例子吗?

2 个答案:

答案 0 :(得分:1)

您可以使用其REST API在Azure DevOps中触发生成。 API for triggering build is documented here

基本上是对以下端点的POST操作:

POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.0

还有authentication can be done using OAuth or Personal Access Token as documented here

取决于您选择的技术,there may also be a client object model you can use

A powershell sample can be found here

答案 1 :(得分:1)

这可以使用Azure Pipeline版本在本地完成。

  1. 在Azure DevOps和您的Service Connection之间创建Jenkins Server
  2. 在Azure Devops中“管道”部分下的“发行”选项卡中创建新的发行管道
  3. Add an artifact to the release pipeline(在左侧)。在出现的视图中,选择“ 4更多工件资源”,Jenkins将出现。
  4. 选择从下拉菜单中为Jenkins连接创建的服务连接,然后从下一个下拉菜单中选择Jenkins Job。

这使您的开发人员更清楚地了解发生了什么。尽管使用休息是一个好方法,但它隐藏了很多工作。这样,任何查看发行版首页的人都可以看到工件的来源。

HTH