Cancel or abort a freestyle job and mark job as success

829 views
Skip to first unread message

mark....@subccontrol.com

unread,
May 24, 2018, 1:00:03 AM5/24/18
to Jenkins Users
I've been scouring the internet for a way to do this and have had no success

We use git as our source control
Our jenkins server is running in windows
I am using windows batch scripts for several build tasks
I have written a batch script that checks the commit message for a specific bit of text that indicates that we don't want jenkins to build this job.  At the end of this script I would like jenkins to halt all further build steps and mark the job as a success.

I could easily do this with:
exit 1
but that would result in the job being marked as failed, and then a bunch of people receive emails when they are not supposed to.

Any advice?
Thanks.

SubC Imaging is a division of SubC Control Ltd. For additional information about SubC Imaging, please visit our website at http://www.subcimaging.com


This email and any attached files are intended for the sole use of the primary and copied addressee(s) and may contain privileged and/or confidential information.


Any distribution, use or copying by any means of this information is strictly prohibited. If you received this email in error, please delete it immediately and notify the sender.

Victor Martinez

unread,
May 24, 2018, 4:53:35 AM5/24/18
to Jenkins Users
I used https://wiki.jenkins.io/display/JENKINS/Groovy+Postbuild+Plugin in the past to manipulate the build status. It might help you 

Cheers

Cuong Tran

unread,
May 24, 2018, 10:58:04 AM5/24/18
to Jenkins Users
You can exit 0. You can also tell Jenkins to mark the job as unstable with a specific exit code.

Eric Pyle

unread,
May 24, 2018, 11:15:02 AM5/24/18
to Jenkins Users
Assuming you are using the freestyle job type, you could make the further build steps part of a Conditional steps build step. The status for the condition could be determined by running your batch script, or by creating (or not) a file in the workspace during your batch script as a flag on whether to continue.

-Eric


--
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 jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/316344fa-c1b1-4701-bc00-963d21798c2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Eric Pyle
Siemens PLM Software
Lebanon, New Hampshire
+1 603-277-3060 (T)
eric...@siemens.com
http://www.siemens.com 

mark....@subccontrol.com

unread,
May 24, 2018, 3:08:59 PM5/24/18
to Jenkins Users
As far as I understand neither of these will abort the build.  I want to prevent further build steps from executing and mark the build as success

mark....@subccontrol.com

unread,
May 24, 2018, 3:10:32 PM5/24/18
to Jenkins Users
That is what I have done now.  I'm hoping it works.


On Thursday, May 24, 2018 at 12:45:02 PM UTC-2:30, Eric Pyle wrote:
Assuming you are using the freestyle job type, you could make the further build steps part of a Conditional steps build step. The status for the condition could be determined by running your batch script, or by creating (or not) a file in the workspace during your batch script as a flag on whether to continue.

-Eric

On Thu, May 24, 2018 at 12:23 AM, <mark....@subccontrol.com> wrote:
I've been scouring the internet for a way to do this and have had no success

We use git as our source control
Our jenkins server is running in windows
I am using windows batch scripts for several build tasks
I have written a batch script that checks the commit message for a specific bit of text that indicates that we don't want jenkins to build this job.  At the end of this script I would like jenkins to halt all further build steps and mark the job as a success.

I could easily do this with:
exit 1
but that would result in the job being marked as failed, and then a bunch of people receive emails when they are not supposed to.

Any advice?
Thanks.

SubC Imaging is a division of SubC Control Ltd. For additional information about SubC Imaging, please visit our website at http://www.subcimaging.com


This email and any attached files are intended for the sole use of the primary and copied addressee(s) and may contain privileged and/or confidential information.


Any distribution, use or copying by any means of this information is strictly prohibited. If you received this email in error, please delete it immediately and notify the sender.

--
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 jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages