Ignore Post Build Job failure in Jenkins Pipeline

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

Ignore Post Build Job failure in Jenkins Pipeline

Ven H
Hi,

I have a JobA defined in Jenkins Pipeline. When JobA builds successfully, I trigger JobB from the Post step. But, if JobB fails in some step, it marks JobA also as Failed.

Is there a way (some setting or option) to ignore the failure in JobB so that it doesn't fail JobA (since it built successfully)?

Regards,
Venkatesh

--
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/CAPp28eqShuPLEaiyLS0sYqqJH2jD7VK-0s%2BkxrEPbXk2BT%2BEXA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ignore Post Build Job failure in Jenkins Pipeline

jeremy mordkoff
Are you using scripted or declarative? I will assume scripted since that's all I know :)

There's a don't wait option. Or you could wrap the call in a try/catch. Or you could save currentBuild.result before calling job B and restore it after



On Friday, August 21, 2020 at 5:09:57 AM UTC-4 [hidden email] wrote:
Hi,

I have a JobA defined in Jenkins Pipeline. When JobA builds successfully, I trigger JobB from the Post step. But, if JobB fails in some step, it marks JobA also as Failed.

Is there a way (some setting or option) to ignore the failure in JobB so that it doesn't fail JobA (since it built successfully)?

Regards,
Venkatesh

--
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/2ff128f9-90d4-496c-942e-321101096fa3n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ignore Post Build Job failure in Jenkins Pipeline

Ven H
Hi Jeremy,

Thanks a lot for your response. I am using a Declarative approach (Jenkinsfile). Could you please provide some more details on the don't wait option, if possible? JobA runs successfully and triggers JobB from Post build. But if JobB fails, it marks JobA also as failed even though JobA ran successfully. I want JobA to trigger JobB on Post success condition and then not fail JobA, if JobB fails, preferably without try/catch blocks.

Regards,
Venkatesh


On Fri, Aug 21, 2020 at 9:31 PM jeremy mordkoff <[hidden email]> wrote:
Are you using scripted or declarative? I will assume scripted since that's all I know :)

There's a don't wait option. Or you could wrap the call in a try/catch. Or you could save currentBuild.result before calling job B and restore it after



On Friday, August 21, 2020 at 5:09:57 AM UTC-4 [hidden email] wrote:
Hi,

I have a JobA defined in Jenkins Pipeline. When JobA builds successfully, I trigger JobB from the Post step. But, if JobB fails in some step, it marks JobA also as Failed.

Is there a way (some setting or option) to ignore the failure in JobB so that it doesn't fail JobA (since it built successfully)?

Regards,
Venkatesh

--
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/2ff128f9-90d4-496c-942e-321101096fa3n%40googlegroups.com.

--
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/CAPp28eqk2kZVbqw%2BnBbK3RPfhMo3NZgUr_nzPDW82kHgpni%3Dsg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ignore Post Build Job failure in Jenkins Pipeline

jeremy mordkoff
I only know scripted, which has 3 options:

wait for completion and propagate errors: 
build job: 'lp_systemtest3/master'

no propagate errors
build propagate: false, job: 'lp_systemtest3/master'

don't wait
build wait: false, job: 'lp_systemtest3/master'

On Friday, August 21, 2020 at 1:05:08 PM UTC-4 [hidden email] wrote:
Hi Jeremy,

Thanks a lot for your response. I am using a Declarative approach (Jenkinsfile). Could you please provide some more details on the don't wait option, if possible? JobA runs successfully and triggers JobB from Post build. But if JobB fails, it marks JobA also as failed even though JobA ran successfully. I want JobA to trigger JobB on Post success condition and then not fail JobA, if JobB fails, preferably without try/catch blocks.

Regards,
Venkatesh


On Fri, Aug 21, 2020 at 9:31 PM jeremy mordkoff <[hidden email]> wrote:
Are you using scripted or declarative? I will assume scripted since that's all I know :)

There's a don't wait option. Or you could wrap the call in a try/catch. Or you could save currentBuild.result before calling job B and restore it after



On Friday, August 21, 2020 at 5:09:57 AM UTC-4 [hidden email] wrote:
Hi,

I have a JobA defined in Jenkins Pipeline. When JobA builds successfully, I trigger JobB from the Post step. But, if JobB fails in some step, it marks JobA also as Failed.

Is there a way (some setting or option) to ignore the failure in JobB so that it doesn't fail JobA (since it built successfully)?

Regards,
Venkatesh

--
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/2ff128f9-90d4-496c-942e-321101096fa3n%40googlegroups.com.

--
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/70e3e916-6a1d-47fd-8ab6-4544575c5d6fn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ignore Post Build Job failure in Jenkins Pipeline

Ven H
Thanks a lot once again, Jeremy. Just curious. Are there any major functional differences between Declarative and Scripted? I thought there are only minor differences. So, if something works in Scripted approach, it should work in Declarative approach as well, right?

With that said, you have provided another option "Propagate". Can I use both "wait" & "propagate"? Sorry for being naive, but I am new to Pipeline scripting.

Regards,
Venkatesh


On Fri, Aug 21, 2020 at 11:13 PM jeremy mordkoff <[hidden email]> wrote:
I only know scripted, which has 3 options:

wait for completion and propagate errors: 
build job: 'lp_systemtest3/master'

no propagate errors
build propagate: false, job: 'lp_systemtest3/master'

don't wait
build wait: false, job: 'lp_systemtest3/master'

On Friday, August 21, 2020 at 1:05:08 PM UTC-4 [hidden email] wrote:
Hi Jeremy,

Thanks a lot for your response. I am using a Declarative approach (Jenkinsfile). Could you please provide some more details on the don't wait option, if possible? JobA runs successfully and triggers JobB from Post build. But if JobB fails, it marks JobA also as failed even though JobA ran successfully. I want JobA to trigger JobB on Post success condition and then not fail JobA, if JobB fails, preferably without try/catch blocks.

Regards,
Venkatesh


On Fri, Aug 21, 2020 at 9:31 PM jeremy mordkoff <[hidden email]> wrote:
Are you using scripted or declarative? I will assume scripted since that's all I know :)

There's a don't wait option. Or you could wrap the call in a try/catch. Or you could save currentBuild.result before calling job B and restore it after



On Friday, August 21, 2020 at 5:09:57 AM UTC-4 [hidden email] wrote:
Hi,

I have a JobA defined in Jenkins Pipeline. When JobA builds successfully, I trigger JobB from the Post step. But, if JobB fails in some step, it marks JobA also as Failed.

Is there a way (some setting or option) to ignore the failure in JobB so that it doesn't fail JobA (since it built successfully)?

Regards,
Venkatesh

--
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/2ff128f9-90d4-496c-942e-321101096fa3n%40googlegroups.com.

--
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/70e3e916-6a1d-47fd-8ab6-4544575c5d6fn%40googlegroups.com.

--
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/CAPp28eqeGVr75mKSk9x5yFoqbbx%2BD%3DM-qV7z_g7fau%2BSeyRf7g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Ignore Post Build Job failure in Jenkins Pipeline

jeremy mordkoff
if you don't wait, then propagate is meaningless .. it can't be done. 

I find scripted is more flexible, but any time a system gives you more rope, you have to be careful not to hang yourself.


---
Jeremy Mordkoff

Director of Engineering Services
RIFT, inc
900 Chelmsford Street,  4th floor, tower 3
Lowell, MA 01851
1.978.257.2183 (cell)

From: [hidden email] <[hidden email]> on behalf of Ven H <[hidden email]>
Sent: Friday, August 21, 2020 1:54 PM
To: [hidden email] <[hidden email]>
Subject: Re: Ignore Post Build Job failure in Jenkins Pipeline
 
Thanks a lot once again, Jeremy. Just curious. Are there any major functional differences between Declarative and Scripted? I thought there are only minor differences. So, if something works in Scripted approach, it should work in Declarative approach as well, right?

With that said, you have provided another option "Propagate". Can I use both "wait" & "propagate"? Sorry for being naive, but I am new to Pipeline scripting.

Regards,
Venkatesh


On Fri, Aug 21, 2020 at 11:13 PM jeremy mordkoff <[hidden email]> wrote:
I only know scripted, which has 3 options:

wait for completion and propagate errors: 
build job: 'lp_systemtest3/master'

no propagate errors
build propagate: false, job: 'lp_systemtest3/master'

don't wait
build wait: false, job: 'lp_systemtest3/master'

On Friday, August 21, 2020 at 1:05:08 PM UTC-4 [hidden email] wrote:
Hi Jeremy,

Thanks a lot for your response. I am using a Declarative approach (Jenkinsfile). Could you please provide some more details on the don't wait option, if possible? JobA runs successfully and triggers JobB from Post build. But if JobB fails, it marks JobA also as failed even though JobA ran successfully. I want JobA to trigger JobB on Post success condition and then not fail JobA, if JobB fails, preferably without try/catch blocks.

Regards,
Venkatesh


On Fri, Aug 21, 2020 at 9:31 PM jeremy mordkoff <[hidden email]> wrote:
Are you using scripted or declarative? I will assume scripted since that's all I know :)

There's a don't wait option. Or you could wrap the call in a try/catch. Or you could save currentBuild.result before calling job B and restore it after



On Friday, August 21, 2020 at 5:09:57 AM UTC-4 [hidden email] wrote:
Hi,

I have a JobA defined in Jenkins Pipeline. When JobA builds successfully, I trigger JobB from the Post step. But, if JobB fails in some step, it marks JobA also as Failed.

Is there a way (some setting or option) to ignore the failure in JobB so that it doesn't fail JobA (since it built successfully)?

Regards,
Venkatesh

--
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/2ff128f9-90d4-496c-942e-321101096fa3n%40googlegroups.com.

--
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/70e3e916-6a1d-47fd-8ab6-4544575c5d6fn%40googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/WtSGFeRvRS4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPp28eqeGVr75mKSk9x5yFoqbbx%2BD%3DM-qV7z_g7fau%2BSeyRf7g%40mail.gmail.com.

--
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/MN2PR18MB276898DCDB762FDF4AF29A12885B0%40MN2PR18MB2768.namprd18.prod.outlook.com.