Suppressing certain builds

已查看 11 次
跳至第一个未读帖子

jeremy mordkoff

未读,
2020年9月17日 12:17:362020/9/17
收件人 Jenkins Users
I use scripted pipelines

I would like certain builds to abort early. (1) if it is just a branch creation event, (2) if the commit message is "bump" and (3) if the only change was in certain submodules. 

I think I know all the pieces to make this work -- I can write a tool that could determine if a build was needed or not. What I don't know is what is the best way to abort the pipeline. Do I set the currentBuild.status and return? Or do I need to wrap all of the subsequent stages in an if?

zil...@gmail.com

未读,
2020年9月17日 15:30:012020/9/17
收件人 Jenkins Users
Can you give a simple example?

jeremy mordkoff

未读,
2020年9月17日 16:07:092020/9/17
收件人 Jenkins Users

node { 
 stage("checkout") { 
   checkout scm 
   result = sh (script: "git log -1 | grep bump", returnStatus: true) 
   if (result == 0) { 
      println("CI bump commit...skipping build")
      currentBuild.result = 'NOT_BUILT'
      # can I just return here ? exit 0? 
   }
 }
 stage("build") { 
....

回复全部
回复作者
转发
0 个新帖子