[
https://issues.apache.org/jira/browse/CASSANDRA-18785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jacek Lewandowski updated CASSANDRA-18785:
------------------------------------------
Description:
Add the ability to run the Sonar analysis and submit results to the Sonar
Server instance.
Additional Ant tasks are available to set up the Sonar server locally in a
docker container. The scripts can configure the local server instance using the
REST API, which includes setting up the project, getting the analysis token,
and installing the quality profile and quality gate (stored in {{.build/sonar}}
directory).
The usage description is available in {{.build/README.md}}
was:
Env variables:
- {{SONAR_SERVER_URL}} - default value:
{{[http://127.0.0.1:9000|http://127.0.0.1:9000/]}} - the running instance of
SonarQube server
- {{SONAR_PROJECT_KEY}} - default value: {{<git branch name>-<git worktree
name>}} - the Cassandra project key as defined in the SonarQube server instance
- {{SONAR_CASSANDRA_TOKEN}} - the analysis token for the Cassandra project; it
is required when {{SONAR_SERVER_URL}} is explicitly provided
Tasks:
1. {{ant sonar}} - runs the Sonar scan of the project and generate an HTML
report. It requires the server is running and the project is configured
2. {{ant start-sonar-server}} - pulls the Docker image of the SonarQube
Community server, starts it, awaits until ready, and update admin credentials
to {{admin:password}} (they are initially {{admin:admin}} and Sonar forces
changing them on first login)
3. {{ant stop-sonar-server}} - stops the local Docker container running the
SonarQube server; does not remove the container so that it can be restarted and
the previous analysis results can be inspected
When the server is running, you can configure SonarLinter plugin in IntelliJ to
connect to the server and use the same quality profile.
Run modes:
- External - when the {{SONAR_SERVER_URL}} env variable is defined, the script
assumes that the server is already fully setup and the script should only
submit the analysis results. In this case, it does not update the project's
quality profile using the configuration stored in the branch - it is up to the
user to configure the project in external SonarQube instance
- Internal - when the {{SONAR_SERVER_URL}} env variable is not set, the script
assumes that the server is running locally at the address and port; In this
case, the script automatically tries to create the project with name/key
defined in {{{}SONAR_PROJECT_KEY{}}}, upload the quality profile for the
project from {{{}.build/sonar-quality-profile.xml{}}}, and recreate the
analysis token, which is then used for the analysis. To perform those
operations, the script must provide admin credentials for the local SonarQube
server instance - they are assumed to be {{{}admin:password{}}}.
The quality profile attached in the {{.build/sonar-quality-profile.xml}} file
is the copy of the default SonarWay Java profile but it can be customized per
branch.
After the analysis, a simple HTML report is generated by listing the existing
issues in the project.
> Add optional task to run Sonar analysis
> ---------------------------------------
>
> Key: CASSANDRA-18785
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18785
> Project: Cassandra
> Issue Type: Task
> Components: Build
> Reporter: Jacek Lewandowski
> Assignee: Jacek Lewandowski
> Priority: Normal
> Time Spent: 10h 40m
> Remaining Estimate: 0h
>
> Add the ability to run the Sonar analysis and submit results to the Sonar
> Server instance.
> Additional Ant tasks are available to set up the Sonar server locally in a
> docker container. The scripts can configure the local server instance using
> the REST API, which includes setting up the project, getting the analysis
> token, and installing the quality profile and quality gate (stored in
> {{.build/sonar}} directory).
> The usage description is available in {{.build/README.md}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]