詹金斯建立了流程

时间:2014-12-29 19:00:14

标签: groovy jenkins jenkins-plugins jenkins-cli

我正在使用build flow插件运行一个groovy脚本,问题是我每次尝试运行下一个构建时其中一个构建都没有成功时会得到错误,这是我的脚本:

def RavenAppToBuild = params["project"] + "_Flow"
out.println "Building " + RavenAppToBuild
b = build(RavenAppToBuild, PlatformProject: params["PlatformProject"], PLATFORM_PATH: params["PLATFORM_PATH"])
def ProjectName= b.environment.get("JOB_NAME")
out.println "The application job name is : " + ProjectName
out.println "Updating the platdorm recommended link..."
build ("Update_Platform_Recommended_Link_Flow", PlatformProject: params["PlatformProject"] , NewBaseline: params["NewBaseline"], ProjectName: ProjectName )
out.println "Recommending ive baseline..."
build ("recommend_ive_baseline_Flow", PlatformProject: params["PlatformProject"], ProjectName: ProjectName  )
def chassisToRecommend = params["PlatformProject"] + "_Chassis_Recommended_Flow"
out.println "Building " + chassisToRecommend
build (chassisToRecommend, ProjectName: ProjectName)
out.println "Running release notes job"
build ("release_notes_Flow", PlatformProject: params["PlatformProject"], BaselineToCompare: params["BaselineToCompare"])

我如何控制我的这个过程,我不确定在很多条件下使用构建状态(FAIL / SUCCESS)是非常有效的。 如果其中一个构建失败,有没有办法停止这些过程。

1 个答案:

答案 0 :(得分:0)

您可以使用Build Flow plugin page中所述的guard / rescue语法来运行一系列作业并在结束时执行清理操作,或者如果任何构建失败。

  

您可能需要在作业(或作业集)成功或不成功后运行清理作业。防护/救援结构专为此用例而设计。它的工作方式大致类似于Java语言中的try + finally块