Problems using retry() when failures occur in pipeline
11 views
Skip to first unread message
Mike Kingsbury
unread,
Aug 31, 2016, 11:19:31 AM8/31/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Users
I have a fairly simple block of code we run to update a system, that occasionally fails due to problems outside our control. I thought this would be a great place to wrap it in a retry block. The problem I have is that even though the retry block is successful later on, it fails the build at the end due to the earlier failure. I also tried unsuccessfully to wrap this in a try/catch without much luck. Any suggestions on how to not fail a build if the retry block is successful? (I may just pull this out into a separate shell script at this point...)
int retry_count =0 retry(25){ if( retry_count !=0){ sleep(10) } retry_count++ sh 'sudo apt -y autoremove'
sh 'sudo apt-get update' sh 'sudo apt-get -y -f upgrade' sh './make-deps.sh' }