Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDBC settings from sonar.properties are ignored #323

Closed
sns-seb opened this issue Sep 26, 2019 · 1 comment
Closed

JDBC settings from sonar.properties are ignored #323

sns-seb opened this issue Sep 26, 2019 · 1 comment

Comments

@sns-seb
Copy link
Contributor

sns-seb commented Sep 26, 2019

Observed behavior

When mounting the conf directory with a customized sonar.properties file which defines the JDBC properties to connect to the database, SonarQube ignores these properties.

Expected behavior

SonarQube connects to the database I specify by properties in the sonar.properties file.

How to reproduce

(with SQ 8 community built from branch feature/sl/initialized_read_volumes)

Create a conf directory to mount in SQ container:

mkdir -p /tmp/sq/conf
chmod 777 /tmp/sq/conf

Start SQ container to get an initialized conf directory. Observe that SQ is running on H2.

docker run -p "9000:9000" --name="sq" -v "/tmp/sq/conf:/opt/sonarqube/conf" -d sq8

Stop SQ:

docker stop sq

Add JDBC properties to sonar.properties:

sudo vi /tmp/sq/conf/sonar.properties

Sample jdbc properties, exact values do not matter since they are ignored:

sonar.jdbc.username=foo
sonar.jdbc.password=bar
sonar.jdbc.url=jdbc:postgresql://localhost:5432/acme

Restart SQ container:

docker start sq

Connect to SQ and/or check logs, SQ still connect to an H2 database.

Suspected cause

Entry point script run.sh passes env properties to the SonarQube process for JDBC properties sonar.jdbc.name, sonar.jdbc.password and sonar.jdbc.url.

These properties takes precedence over the content of sonar.properties even when empty.

In the scenario above, sonar.jdbc.url is empty because its value is the one of the env variable SONAR_JDBC_URL. Even when SONAR_JDBC_URL is not set, this defines an empty value to the env property.

An empty sonar.jdbc.url is interpreted by SonarQube as "connect to H2".

Note that as a consequence, the same problem applies to property sonar.web.javaAdditionalOpts.

ghost pushed a commit that referenced this issue Oct 2, 2019
* [#323] enable unofficial strict bash mode on run.sh
* [#323] do not ignore jdbc settings from sonar.properties
* [#323] don't ignore sonar.web.javaAdditionalOpts of sonar.properties
* apply feedback
* review
@ghost ghost closed this as completed Oct 2, 2019
@QkiZMR
Copy link

QkiZMR commented Oct 22, 2020

This bug is still present in 7.9.4-community version

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants