[JENKINS-38992] add ability to cache shared libraries #85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
We hit the same problem like Julien Duchesne in #50 . We have a lot of jobs which use our library. Unfortunately, too many requests to our git server ends with 403 permission denied (our server classifies our requests as DOS 馃槈). I analyzed the comments in #50 and tried to prepare a new implementation proposal.
How it works:
LibraryRetriever
(as was suggested in [JENKINS-38992] Allow caching library versions聽#50). It means it works for libraries added in Jenkins panel and loaded bylibrary
step (developers are able to setadditionalKey
to prevents overwriting cache by different git libraries)Stuff to improve:
SCM#getKey
to cache entry id, I didn't do it because it is available only forlegacySCM
. Modern provides onlySCMSource#getId
which according to documentation does not guarantee to return the same values for the same repositories. Please let me know what should I do? I can add both or add it only forlegacySCM
we use Kubernetes, and I see that library is always downloaded before the slave container is created. It sounds to me that libraries are always downloaded by code executed on master. If this is true, then I should be able to remove locking based on files and use Java locks. What do you think?Missing stuff:
Comments:
We are testing it now on environment which for a single build schedules additional 120 jobs. All those jobs need our library. The cache works quite stable for TTL >= 30 seconds, for TTL = 3 seconds it switches a lot of time to non-cache mode. We haven't hit a problem with broken cache yet (it is possible when two threads ask for a write lock exactly at the same time, and next write to the same directory).
Please let me know what should I improve. We really needs this feature, so we have capacity for adjusting the PR to your comments.
Kind regards