Skip to content

Commit a2fc675

Browse files
committed
Update Sonar setup for private projects
1 parent a2ad1e2 commit a2fc675

File tree

2 files changed

+47
-15
lines changed

2 files changed

+47
-15
lines changed

doc/changes/unreleased.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,44 @@
22

33
## Summary
44
This version of the PTB adds nox task `sonar:check`, see #451. This allows us to
5-
use SonarQube Cloud to analyze, visualize, & track linting, security, & coverage. In
6-
order to properly set it up, you'll need to do the following instruction for each **public** project.
7-
At this time, PTB currently does not support setting up SonarQube for a **private** project.
5+
use SonarQube Cloud to analyze, visualize, & track linting, security, & coverage. To
6+
set it up, you'll need to execute the following instructions.
87

8+
### For a public project
99
1. Specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
1010
```python
11-
source: Path = Path("exasol/toolbox")
12-
```
13-
2. Add the 'SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner).
14-
3. Activate the SonarQubeCloud App
11+
source: Path = Path("exasol/<project-source-folder>")
12+
```
13+
2. Add the 'SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner)
14+
3. Activate the [SonarQubeCloud App](https://github.com/apps/sonarqubecloud)
1515
4. Create a project on SonarCloud
1616
5. Add the following information to the project's file `pyproject.toml`
1717
```toml
18+
1819
[tool.sonar]
1920
projectKey = "com.exasol:<project-key>"
2021
hostUrl = "https://sonarcloud.io"
2122
organization = "exasol"
22-
```
23+
```
2324
6. Post-merge, update the branch protections to include SonarQube analysis
2425

26+
### For a private project
27+
1. Specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
28+
```python
29+
source: Path = Path("exasol/<project-source-folder>")
30+
```
31+
2. Add the 'PRIVATE_SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner)
32+
3. Activate the [exasonarqubeprchecks App](https://github.com/apps/exasonarqubeprchecks)
33+
4. Create a project on https://sonar.exasol.com
34+
5. Add the following information to the project's file `pyproject.toml`
35+
```toml
36+
[tool.sonar]
37+
projectKey = "com.exasol:<project-key>"
38+
hostUrl = "https://sonar.exasol.com"
39+
organization = "exasol"
40+
```
41+
6. Post-merge, update the branch protections to include SonarQube analysis from exasonarqubeprchecks
42+
2543
## ✨ Features
2644
* #451: Added nox task to execute pysonar & added Sonar to the CI
2745

doc/user_guide/getting_started.rst

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,16 @@ We also need to configure settings for github-pages environment:
202202
8. Set up for Sonar
203203
+++++++++++++++++++
204204
PTB supports using SonarQube Cloud to analyze, visualize, & track linting, security, &
205-
coverage. In order to properly set it up, you'll need to do the following instructions
206-
for each **public** project. At this time, PTB currently does not support setting up
207-
SonarQube for a **private** project.
205+
coverage. In order to set it up, you'll need to do the following instructions.
208206

207+
For a **public** project
208+
^^^^^^^^^^^^^^^^^^^^^^^^
209209
1. Specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
210210
.. code-block:: python
211211
212-
source: Path = Path("exasol/toolbox")
213-
2. Add the 'SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner).
214-
3. Activate the SonarQubeCloud App
212+
source: Path = Path("exasol/<project-source-folder>")
213+
2. Add the 'SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner)
214+
3. Activate the `SonarQubeCloud App <https://github.com/apps/sonarqubecloud>`_
215215
4. Create a project on SonarCloud
216216
5. Add the following information to the project's file `pyproject.toml`
217217
.. code-block:: toml
@@ -222,7 +222,21 @@ SonarQube for a **private** project.
222222
organization = "exasol"
223223
6. Post-merge, update the branch protections to include SonarQube analysis
224224

225-
225+
For a **private** project
226+
^^^^^^^^^^^^^^^^^^^^^^^^^
227+
1. Specify in the `noxconfig.py` the relative path to the project's source code in `Config.source`
228+
.. code-block:: python
229+
source: Path = Path("exasol/<project-source-folder>")
230+
2. Add the 'PRIVATE_SONAR_TOKEN' to the 'Organization secrets' in GitHub (this requires a person being a GitHub organization owner)
231+
3. Activate the `exasonarqubeprchecks App <https://github.com/apps/exasonarqubeprchecks>`_
232+
4. Create a project on https://sonar.exasol.com
233+
5. Add the following information to the project's file `pyproject.toml`
234+
.. code-block:: toml
235+
[tool.sonar]
236+
projectKey = "com.exasol:<project-key>"
237+
hostUrl = "https://sonar.exasol.com"
238+
organization = "exasol"
239+
6. Post-merge, update the branch protections to include SonarQube analysis from exasonarqubeprchecks
226240

227241
9. Go 🥜
228242
+++++++++++++

0 commit comments

Comments
 (0)