Regular AbstractProject builds have a loop for retrying SCM checkouts when they fail throwing IO Exceptions. This retry loop is useful, because in certain circumstances the git server may disconnect, such as the following exception:
ERROR: Error fetching remote repo '<REMOTE>'
hudson.plugins.git.GitException: Failed to fetch <URL>
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress <URL> <REFSPEC>" returned status code 128:
stderr: key_load_public: invalid format
Received disconnect from <SERVER> port <PORT>: Too many concurrent connections
Connection to <SERVER> closed by remote host.
fatal: Could not read from remote repository.
Basically, sometimes this server gets too much load and decides to disconnect the clones. Unfortunately this behavior can't be fixed on that end, and thus the retry loop is the only way to catch this.
In regular pipelines, I can write pipeline code which does the retry for myself. However, I'm unable to do this for the checkout step that occurs as part of fetching the pipeline code.
Is it possible to add the retry logic to the checkout step so that it will attempt to retry the checkout when it fails under this disconnection?