詹金斯 - 构建步骤之间的条件 [英] Jenkins - conditions between build steps

查看:103
本文介绍了詹金斯 - 构建步骤之间的条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建立使用詹金斯Maven项目。然而,该项目只有必须如果SVN仓库的某个文件已经改变(并包含一个特殊的键)内置

I want to build a Maven project using Jenkins. However, the project only must be built if a certain file in the SVN repository has changed (and contains a special key)

所以我的计划是创建一个作业有两个构建步骤:

So my plan is to create a job with two build steps:


  • 第一步执行一个shell或Python脚本来检查该条件。

  • the first step executes a shell or python script that checks that "condition".

第二步是实际的Maven构建

the second step is the actual Maven build

第二步只有必须调用如果在步骤1中的条件检查返回真。

The second step only must be invoked if the condition check in step 1 returned "true".

有可能这样做?嗯,我想我可以在第一个脚本返回退出code 1,如果条件不满足。这将停止在构建一次,但该作业将被标记为失败。因此,这不是一个好主意,因为红色的图标,使我的用户惊慌; - )

Is there a possibility to do so? Well, I guess I could return an exit code 1 in the first script if the condition is not met. This will stop the build at once, but the job will be marked as "failed". So this is not a good idea since the red icon makes my users panic ;-)

解决这个任何其他的想法?

Any other ideas around this?

干杯,
弗兰克

Cheers, Frank

推荐答案

我们做我们自己的詹金斯设置类似的东西。

We do something similar with our own Jenkins setup.

我们有一个触发作业监控SVN定期。当变化发生时SVN,触发作业执行其生成步骤。之一的构建步骤检查code的某些方面,并决定一个构建是否需要与否。如果有必要,它使用卷曲启动了建设项目的启动。 建项目获得源$ C ​​$ c和做一个构建 - 它不打扰弄清楚是否需要建立或不 - 。它总是

We have a "trigger" job that monitors SVN on a periodic basis. When a change occurs in SVN, the trigger job executes its build steps. One of the build steps examines some aspects of the code and decides whether a build is necessary or not. If it is necessary, it uses CURL to initiate the start of a the "build" project. The "build" project gets the source code and does a build - it doesn't bother to figure out whether it needs to build or not - it always does.

有两个任务分开也可以很容易地不用担心的应该-I-构建逻辑踢和停止构建触发手工打造。

Having the two tasks separate also makes it easy to trigger a manual build without worrying the should-I-build logic kicking and stopping the build.

这篇关于詹金斯 - 构建步骤之间的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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