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'
    }


-- 
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/e325c302-55c1-4c45-8604-20976e23dc43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to