At IDRsolutions, we have spent the last 6 months working to make our Java code base for our Java PDF Library and PDF to HTML5 Converter more modular. This has the downside of generating lots of fetch requests across the Internet and we see timeout issues in Git which then fail our main tests. So we have reduced this by having the repositories mirrored on disk. Here is how we did it:
1. Setup Local repositories
Previously, every task would attempt to poll the main repositories. On our Hudson box, the Git mirrors now live in /Users/hudson/repositories/ and our Jenkin’s mirrors live in C:\repositories
The mirror is created by the command
git clone –mirror https://path/ToCode/module.git
The mirror tag is needed because the version you normally check out (which creates a .git directory) does not work.
2. Add a task to update the mirror copy
We now add a task to listen to the original Git repository and update our mirror copy when there are changes. We do this with a simple fetch. You setup a task for each module.
3. Set existing tasks to use the mirror repositories
Finally you point the existing tests to use the Git mirrors on disk. You can use file::/ or just the path.
As well as reducing traffic substantially, a side-effect is that the tests can now be easily disabled just by disabling the sync tasks, and you will not see your main tests fail if there is an issue with the Git pull.
We have found this makes our tests substantially more robust and we hope you find it useful too. Let us know…
Latest posts by Mark Stephens (see all)
- NetBeans Day UK announced for Tuesday 25th April 2017 - February 1, 2017
- The 2017 Guide to PDF Files – Creation II - January 19, 2017
- The 2017 Guide to to PDF Files – Creation I - January 17, 2017
- 7 ways we might change the way we develop software in 2017 - January 6, 2017
- IDRsolutions will move to Java8 in April 2017 - November 8, 2016