Closed Zetym closed 1 year ago
Thanks a lot for taking the time to contribute this change back to us :) I reviewed the code quickly and thanks to your explanation it seems good to me I'll discuss this with the maintainer next week so we can merge this asap!
When mapping up a Plastic repository/branch as a Single repository & branch in a Multibranch pipeline, the controller will do a full checkout of the repository for the polling even though a single pipeline does a lightweight checkout. This PR enables the controller to perform lightweight checkouts even when mapped as a single repository & branch in a Multibranch pipeline. This doesn't try to provide full Multibranch support as requested in #32 , but it enables various workarounds to use them.
When determining if the controller should do a lightweight checkout, the Jenkins asks the SCM if it can do lightweight checkouts. In a single pipeline job that question goes directly to this plugin through the supports(SCM scm) method, but in a multibranch Plastic gets wrapped in a SingleSCMSource that gets the question and forwards it to Plastic, but to the supports(SCMSource source) method. This change replicates the behaviour of the first method if the source provided in the second is a SingleSCMSource wrapper.
Testing done
This change has been running internally for two multibranch projects with several branches mapped each for a couple months now without issue. Before implementing this change the controller ran out of disk space immediately on trying to poll all the branches.
Submitter checklist