Skip to content

Commit

Permalink
branch plugin update and fix (#2317)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-rudnouski authored Dec 15, 2021
1 parent 6dd738f commit 3528d01
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Also you may install optional plugins. Be carefull, some of them are not support
- sonar-xanitizer-plugin-2.2.0
- sonar-build-breaker-plugin-2.3.1.347
- sonar-issueresolver-plugin-1.0.2
- sonarqube-community-branch-plugin-1.8.0
- sonarqube-community-branch-plugin-1.8.1

See plugin matrix here: https://docs.sonarqube.org/latest/instance-administration/plugin-version-matrix/

Expand Down
8 changes: 5 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ build_breaker_epversion: "{% if sonar_version is version(\"7.3\", \">=\") %}2.3.

issueresolver_pversion: 1.0.2

branch_pversion: "{% if sonar_version is version(\"8.9.0.43852\", \">=\") %}1.8.0\
branch_pversion: "{% if sonar_version is version(\"8.9.0.43852\", \">=\") %}1.8.1\
{% elif sonar_version is version(\"8.7.0.41497\", \">=\") %}1.7.0\
{% elif sonar_version is version(\"8.5.0.37579\", \">=\") %}1.6.0\
{% elif sonar_version is version(\"8.2.0.32929\", \">=\") %}1.5.0\
Expand Down Expand Up @@ -246,6 +246,9 @@ sonar_default_plugins:
- 'https://binaries.sonarsource.com/Distribution/sonar-jacoco-plugin/sonar-jacoco-plugin-{{ jacoco_pversion }}.jar'

sonar_install_optional_plugins: false

branch_plugin_url: "https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/\
{{ branch_pversion }}/sonarqube-community-branch-plugin-{{ branch_pversion }}.jar"
sonar_optional_plugins:

- "https://github.com/QualInsight/qualinsight-plugins-sonarqube-smell/releases/download/\
Expand Down Expand Up @@ -281,8 +284,7 @@ sonar_optional_plugins:
- "https://github.com/willemsrb/sonar-issueresolver-plugin/releases/download/sonar-issueresolver-plugin-{{ issueresolver_pversion }}/\
sonar-issueresolver-plugin-{{ issueresolver_pversion }}.jar"

- "https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/\
{{ branch_pversion }}/sonarqube-community-branch-plugin-{{ branch_pversion }}.jar"
- '{{ branch_plugin_url }}'

sonar_all_plugins: "{{ sonar_install_recommended_plugins | ternary(sonar_recommended_plugins, []) +\
sonar_update_default_plugins | ternary(sonar_default_plugins, []) +\
Expand Down
8 changes: 2 additions & 6 deletions tasks/system/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,16 @@
notify: Restart Sonarqube
loop: '{{ sonar_all_plugins }}'

- name: Get branch plugin url
set_fact:
branch_plugin_url: "https://github.com/mc1arke/sonarqube-community-branch-plugin/releases/download/\
{{ branch_pversion }}/sonarqube-community-branch-plugin-{{ branch_pversion }}.jar"

- name: Copy branch plugin
copy:
src: '{{ sonar_plugins_dir }}/sonarqube-community-branch-plugin-{{ branch_pversion }}.jar'
dest: '{{ sonar_installation }}/lib/common/'
mode: 0644
remote_src: true
when:
- branch_pversion is version("1.2.0", ">=")
- branch_plugin_url in sonar_all_plugins
- branch_pversion is version("1.2.0", ">=")
- branch_pversion is version("1.7.0", "<=")

- meta: flush_handlers

Expand Down
6 changes: 6 additions & 0 deletions templates/sonar.properties.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ sonar.ce.javaOpts={{ sonar_java_opts.ce }}
# CVE-2021-44228, to remove after elasticsearch/lib/log4j-*.jar updated to 2.15.0+ version
sonar.search.javaAdditionalOpts=-Dlog4j2.formatMsgNoLookups=true

{% if branch_plugin_url in sonar_all_plugins and branch_pversion is version("1.8.0", ">=") %}
# branch plugin
sonar.web.javaAdditionalOpts=-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-{{ branch_pversion }}.jar=web
sonar.ce.javaAdditionalOpts=-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-{{ branch_pversion }}.jar=ce
{% endif %}

# update center
sonar.updatecenter.activate={{ sonar_updatecenter_activate | bool | lower }}

Expand Down

0 comments on commit 3528d01

Please sign in to comment.