Issue
Currently in build flow plugin we use following approach. This code will retry twice.
programs_create_servers_retry_count=2
retry(programs_create_servers_retry_count) {
build( "create_virtual_servers",j_SL_data_center_local: programs_create_servers_dc_1,j_random_id_local: random_id)
}
How can do the same Jenkins Pipeline plugin?
Solution
Check retry
method in Jenkins DSL : https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#retry-retry-the-body-up-to-n-times
Example piece of code will look like that:
stage('stageName') {
try {
...
} catch(error) {
retry(3) {
do smth
}
}
}
Where number 3 is number of attempts to retry.
Answered By - stinger