So I was trying too hard - the try/catch isnt' needed at all.
All I needed was:
BuildResults = build job: 'testJob', propagate: false;
notify_email(BuildResults);
On Wednesday, May 17, 2017 at 10:45:27 AM UTC+8, Jesse Kinross-Smith wrote:
>
> How can I do this right - I want the results from a job I run (I need to
> run a dozen of these in succession and will email devs if one of them
> fails)
>
> try{ BuildResults = build job: 'testJob'; currentBuild.result='SUCCESS'; }
>> catch(e){ currentBuild.result = 'FAILURE'; } finally {
>> notify_email(BuildResults); }
>
>
> if i do the above I only get a valid BuildResults in notify_email IF the
> job is successful,
> if it fails it causes an exception saying No such property: BuildResults
>
> currentBuild is useless as it's the pipeline results, not the job results
> which is what I want
>
> I need the try/catch so I can continue to run my other jobs - otherwise
> it'll stop immediately once one job fails
>
> I'm sure there's some syntax I'm missing here, but I'm struggling to find
> it.
>
> Any help you can provide is appreciated.
>
> Regards,
>
> Jesse
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/d7b265b8-6152-4c6b-a4a8-1ed8ced20df6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.