简体   繁体   English

在主代理而非从代理中运行Jenkins后期构建步骤

[英]Running Jenkins post build step in master agent instead of slave agent

I installed Jenkins PowerShell plug in and configured a post build step that executes a powershell script which creates a TFS task to the developer who cause the failed build. 我安装了Jenkins PowerShell插件,并配置了一个后构建步骤 ,该步骤执行一个powershell脚本,该脚本为导致构建失败的开发人员创建了TFS任务。

In order to create a TFS task from powershell, some windows based TFS libraries need to be installed. 为了从powershell创建TFS任务,需要安装一些基于Windows的TFS库。 Therefore I need to run this post build action in a Windows environment. 因此,我需要在Windows环境中运行此后构建操作。 But some of our projects are Linux based and we need to build these projects in Linux agents. 但是我们的某些项目基于Linux,因此我们需要在Linux代理中构建这些项目。

Is there any way to run post build step in the master Jenkins agent instead of linux based slave agent? 有什么方法可以在主Jenkins代理而非基于Linux的从代理中运行构建后步骤?

Or is there any other solution to create a TFS task after a failed build in Jenkins? 还是在Jenkins构建失败后有其他解决方案来创建TFS任务?

One workaround will be create a new job which will run the step (One which you want to run in post build step). 一种解决方法是创建一个新作业,该作业将运行该步骤(您要在构建后步骤中运行的一个作业)。 Trigger this job when there is a failure. 发生故障时触发此作业。 And restrict this job to run on master only. 并将此作业限制为仅在主服务器上运行。 Job->Configure->Restrict where this project can be run-> Put the label of master here. 作业->配置->限制此项目的运行位置->在此处放置主标签。

You have to label your master for this to work. 您必须标记您的主人才能正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM