In declarative pipeline there is also the option for a script {} block 
where "traditional" Jenkins scripting can be done, so what you're 
suggesting can be done there. However, I'm not looking to adding the user 
prompt like in your example, which seems like SYSTEM depends on, in your 
example.

Do you have an example without this?
Also, your example is not using the exception try/catch approach in my last 
comment.

On Monday, March 19, 2018 at 1:47:19 PM UTC+2, Victor Martinez wrote:
>
> This is indeed what I did:
> - https://groups.google.com/d/msg/jenkinsci-users/upVzT3SOZy8/N5iguMZsAgAJ
>
> But using scripted pipelines, it looks like you cannot use try/catch 
> within the declarative pipeline but post steps (
> https://jenkins.io/doc/book/pipeline/syntax/#post) but the timeout 
> triggers a failure therefore you need to run something like
>
> pipeline {
>     agent any
>     options {
>         timeout(time: 1, unit: 'SECONDS')
>       }
>     stages {
>         ...
>     }
>     post { 
>         failure { 
>             // Catch failures and even the tiemout one
>         }
>     }
> }
>
>
> I don't know whether the declarative post step allows a kind of more 
> accurate granularity about what caused that particular failure... 
>
> Cheers
>

-- 
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/b68abf28-a3c8-4455-b570-9d3c5aced42a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to