Suppressing certain builds

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Suppressing certain builds

jeremy mordkoff
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?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5a5fa1aa-23ae-4515-9695-b2888f43fec1n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Suppressing certain builds

ZillaYT
Can you give a simple example?

On Thursday, September 17, 2020 at 12:17:36 PM UTC-4 [hidden email] wrote:
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?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b06772a2-9f7c-4007-a355-c4ec5c8033f0n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Suppressing certain builds

jeremy mordkoff

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") { 
....

On Thursday, September 17, 2020 at 3:30:01 PM UTC-4 [hidden email] wrote:
Can you give a simple example?

On Thursday, September 17, 2020 at 12:17:36 PM UTC-4 [hidden email] wrote:
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?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d4bf76d4-c7cb-406c-a66c-8ab9dd7d6ab4n%40googlegroups.com.