Cache plugins in scanner image

I’m running sonarqube LTS (7.9.3) with constant set of plugins. Every time when sonar-scanner is executing (from docker image) the whole set of plugins is being downloaded.

[07:53:46]05:53:46.682 INFO: Load/download plugins
[07:53:46]05:53:46.682 INFO: Load plugins index
[07:53:47]05:53:47.079 DEBUG: GET 200 https://sonar.server.url/api/plugins/installed | time=397ms
[07:53:47]05:53:47.103 INFO: Load plugins index (done) | time=421ms
[07:53:47]05:53:47.104 DEBUG: Download plugin 'citymodel' to '/root/.sonar/_tmp/fileCache1277152374134903786.tmp'
[07:53:47]05:53:47.534 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=citymodel&acceptCompressions=pack200 | time=429ms
[07:53:51]05:53:51.103 DEBUG: Download plugin 'ansible' to '/root/.sonar/_tmp/fileCache6460901915557305129.tmp'
[07:53:51]05:53:51.579 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=ansible&acceptCompressions=pack200 | time=476ms
[07:53:51]05:53:51.587 DEBUG: Download plugin 'buildbreaker' to '/root/.sonar/_tmp/fileCache10150050605696973661.tmp'
[07:53:52]05:53:52.234 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=buildbreaker&acceptCompressions=pack200 | time=647ms
[07:53:55]05:53:55.524 DEBUG: Download plugin 'c' to '/root/.sonar/_tmp/fileCache8104680748231252617.tmp'
[07:53:55]05:53:55.943 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=c&acceptCompressions=pack200 | time=419ms
...
[07:54:39]05:54:39.665 DEBUG: Download plugin 'typescript' to '/root/.sonar/_tmp/fileCache604192864246626205.tmp'
[07:54:40]05:54:40.080 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=typescript&acceptCompressions=pack200 | time=415ms
[07:54:40]05:54:40.082 DEBUG: Download plugin 'xml' to '/root/.sonar/_tmp/fileCache16886563112606426531.tmp'
[07:54:40]05:54:40.456 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=xml&acceptCompressions=pack200 | time=374ms
[07:54:40]05:54:40.964 DEBUG: Download plugin 'yaml' to '/root/.sonar/_tmp/fileCache14867059599174693529.tmp'
[07:54:41]05:54:41.348 DEBUG: GET 200 https://sonar.server.url/api/plugins/download?plugin=yaml&acceptCompressions=pack200 | time=384ms
[07:54:42]05:54:42.278 INFO: Load/download plugins (done) | time=55596ms
[07:54:42]05:54:42.881 DEBUG: Plugins:
[07:54:42]05:54:42.881 DEBUG:   * Cobertura 2.0 (cobertura)
[07:54:42]05:54:42.881 DEBUG:   * SonarCSS 1.2.0.1325 (cssfamily)
[07:54:42]05:54:42.881 DEBUG:   * 3D Code Metrics 3.7 (citymodel)
[07:54:42]05:54:42.881 DEBUG:   * Ansible Lint 2.3.0 (ansible)
[07:54:42]05:54:42.881 DEBUG:   * SonarScala 1.5.0.315 (sonarscala)
[07:54:42]05:54:42.881 DEBUG:   * C# Code Quality and Security 8.6.1.17183 (csharp)
[07:54:42]05:54:42.881 DEBUG:   * Java Code Quality and Security 6.3.0.21585 (java)
[07:54:42]05:54:42.881 DEBUG:   * LDAP 2.2.0.608 (ldap)
[07:54:42]05:54:42.881 DEBUG:   * SonarHTML 3.2.0.2082 (web)
[07:54:42]05:54:42.881 DEBUG:   * SonarXML 2.0.1.2020 (xml)
[07:54:42]05:54:42.881 DEBUG:   * Sonar WebDriver Plugin 1.0.5 (webdriver)
[07:54:42]05:54:42.881 DEBUG:   * SonarTS 2.1.0.4359 (typescript)
[07:54:42]05:54:42.881 DEBUG:   * Build Breaker 2.3.1.347 (buildbreaker)
[07:54:42]05:54:42.881 DEBUG:   * Checkstyle 4.32 (checkstyle)
[07:54:42]05:54:42.882 DEBUG:   * Cloudformation 2.0.5 (cloudformation)
[07:54:42]05:54:42.882 DEBUG:   * Community Branch Plugin 1.3.1 (communityBranchPlugin)
[07:54:42]05:54:42.882 DEBUG:   * YAML Analyzer 1.5.1 (yaml)
[07:54:42]05:54:42.882 DEBUG:   * Dependency-Check 2.0.4 (dependencycheck)
[07:54:42]05:54:42.882 DEBUG:   * C++ (Community) 1.3.2.1853 (cxx)
[07:54:42]05:54:42.882 DEBUG:   * SonarPython 2.8.0.6204 (python)
[07:54:42]05:54:42.882 DEBUG:   * C (Community) 1.3.2.1853 (c)
[07:54:42]05:54:42.882 DEBUG:   * Code Smells 4.0.0 (smells)
[07:54:42]05:54:42.882 DEBUG:   * SonarKotlin 1.5.0.315 (kotlin)
[07:54:42]05:54:42.882 DEBUG:   * ShellCheck Analyzer 2.3.0 (shellcheck)
[07:54:42]05:54:42.882 DEBUG:   * SonarJS 6.2.1.12157 (javascript)
[07:54:42]05:54:42.882 DEBUG:   * Findbugs 4.0.0 (findbugs)
[07:54:42]05:54:42.882 DEBUG:   * Groovy 1.6 (groovy)
[07:54:42]05:54:42.882 DEBUG:   * Git 1.11.1.2008 (scmgit)

Is there any way to “build in” / cache the plugins to avoid the need of downloading every time?

Hi @tomki99,

Did you configure the cache directory for the scanner docker container? Documentation on this can be found here: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/

Cheers,
Mark