[
https://issues.apache.org/jira/browse/CASSANDRA-18785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jacek Lewandowski updated CASSANDRA-18785:
------------------------------------------
Description:
Env variables:
- {{SONAR_SERVER_URL}} - default value: {{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.
was:
The new task is called {{sonar}}.
When you run {{ant sonar}} it will:
- if env variable {{SONAR_SERVER_URL}} it will use that server for the analysis
(it requires also env {{SONAR_CASSANDRA_TOKEN}} in this case)
- else, it checks if there is a Sonar server running at http://127.0.0.1:9000
if so, it will use it, assuming that the {{cassandra}} project exists and is
configured, it also assumes credentials {{admin:password}}; otherwise it will
pull Docker image of SonarQube, run it, and preconfigure automatically using
WEB API.
In other words, unless you have {{SONAR_SERVER_URL}} env variable defined,
{{ant sonar}} will automatically run and configure Sonar server instance on
your local machine, do the analysis and leave the instance running, so that you
can view the results in the browser, and reuse the server for for the next runs.
Server needs to be stopped manually via {{docker}} command.
When the server is running, you can configure SonarLinter plugin in IntelliJ to
connect to the server and use the same quality profile.
Quality profile is attached in the xml file. It is the copy of the default
SonarWay Java profile but it can be customized per branch.
> 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: 7h 40m
> Remaining Estimate: 0h
>
> Env variables:
> - {{SONAR_SERVER_URL}} - default value: {{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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]