Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[JENKINS-39194] Implement SCM retry count #147
@jglick I was having trouble with the custom retry. The job config save doesn't go through the descriptor's configure, so ensuring that the jenkins backend doesn't always set the retry count to 0 for a job was impossible.
To unblock for now I just removed the advanced custom retry setting.
@jglick So if you look at the way that the config-retry.jelly is implemented, it wants to call hasCustomScmCheckoutRetryCount() on the plugin to determine the checkbox, then binds the value of the text box to scmCheckoutRetryCount. scmCheckoutRetryCount is an Integer which is supposed to be null if the box isn't checked. This is accomplished for AbstractProject by overriding submit() on AbstractBuild and determining whether the checkbox was checked, otherwise it resets scmCheckoutRetryCount to null.
In our case, if you don't implement similar logic, then when you save the job, scmCheckoutRetryCount gets assigned a default value, which ends up being 0, rather than null. The right way to fix this I think would be to override Descriptor's configure method, parse the json like AbstractBuild does, and then set the appropriate values. Saving the job doesn't appear to go through configure() in this case.
Anyways, I could be totally wrong on how to implement the custom retry count UI. I played around with it for a while but wasn't able to get it to work. If you have some suggestions, let me know.