Caching plugins

We run the sonar runner on pipelines that use ephemeral containers and ephemeral volumes. In order to reduce the amount of downloads with the plugins we have a separate pipeline that downloads the sonar plugins, creates a tarball and makes it available for other pipelines to install.

Today the tarball is near 300MB and while taking a look at ti we notices that the jar files are unzipped:

17:35:27  cache/49e2cda2295ccbb9beb9ed9759de1d67/sonar-java-plugin.jar
17:35:27  cache/49e2cda2295ccbb9beb9ed9759de1d67/sonar-java-plugin.jar_unzip/

This causes us to create a tarball with duplicated information. We only want to save on downloading from the internet and we do not care about the jar_unzip folders. Will it be ok to exclude these folders from our tarballs, or are they necessary?

We could untag the tarball then recreate the jar_unzip folders from the jar files if necessary. This would probably allow us to have a sonar_cache.tgz file with half of the current size.

Hey there.

My tests tell me that if you remove the jar_unzip folder after the cache is populated, it will be automatically recreated on the next scan.

We were able to confirm the behavior. The Load/download plugins step for the running went from 20-30s to 1s with the cache.

We use tar --exclude='*.jar_unzip' -I 'zstd --long -T4 -15' -cvf sonar_cache.tzst -C ~/.sonar cache to create the tarball, which is a 245MB file. The download/untar is snappy and usually under 10s and should save on bandwidth usage.