[
https://issues.apache.org/jira/browse/CASSANDRA-18785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17784933#comment-17784933
]
Maxim Muzafarov commented on CASSANDRA-18785:
---------------------------------------------
checked locally
+1
Should we merge it to the trunk only?
> 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 20m
> Remaining Estimate: 0h
>
> 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]