def worker_pipeline(){
try{
node("xxxxxxxx") {
stage('Checkout SCM'){
git branch: 'xxxx',
credentialsId: 'xxx',
}
container('xxxxxxxx'){
stage('Run Builds'){
"base_image": {
sh 'gcloud builds submit --config .ci/builds/base_image_cloudbuild.yaml'
},
"assets_dependencies": {
sh 'gcloud builds submit --config .ci/builds/assets_dependencies_cloudbuild.yaml'
}
}
}
}
}
catch(err)
{
if ( "${err}" == "hudson.remoting.RequestAbortedException: java.nio.channels.ClosedChannelException" ){
echo "The Pipeline has failed because of a Connection fail, so retry"
worker_pipeline()
}
else{
echo "${err}"
echo "The pipeline has failed, exit"
throw new Exception("Pipeline has failed, exit")
}
}
}
// Call main function
worker_pipeline()
```