mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 23:05:49 +00:00
Merge branch 'FinalProject_main' of https://github.com/tautaus/spring-petclinic into FinalProject_main
This commit is contained in:
commit
ecbe91384e
2 changed files with 37 additions and 0 deletions
|
@ -107,6 +107,7 @@ services:
|
||||||
- ./:/usr/src
|
- ./:/usr/src
|
||||||
environment:
|
environment:
|
||||||
- SONAR_HOST_URL=http://sonarqube:9000/
|
- SONAR_HOST_URL=http://sonarqube:9000/
|
||||||
|
- SONAR_TOKEN=$MY_SONAR_TOKEN
|
||||||
depends_on:
|
depends_on:
|
||||||
- sonarqube
|
- sonarqube
|
||||||
|
|
||||||
|
|
36
readme.md
36
readme.md
|
@ -92,3 +92,39 @@ docker exec -it spring-petclinic-petclinic-1 bash
|
||||||
- Go back to the Jenkins dashboard.
|
- Go back to the Jenkins dashboard.
|
||||||
- Select your pipeline job.
|
- Select your pipeline job.
|
||||||
- Click on **Build Now** to run the pipeline.
|
- Click on **Build Now** to run the pipeline.
|
||||||
|
|
||||||
|
## Steps 3: Running Static Analysis with Sonarqube
|
||||||
|
1. Access Sonarqube: Open [http://localhost:9000](http://localhost:9000) and set up Sonarqube. Install the suggested plugins.
|
||||||
|
|
||||||
|
2. Login to Sonarqube with the following user and password:
|
||||||
|
- Username: admin
|
||||||
|
- Password: admin (update password when prompted after login)
|
||||||
|
|
||||||
|
3. Create project on Sonarqube
|
||||||
|
- Navigate over to create project
|
||||||
|
- set the following variables:
|
||||||
|
Project display name = petclinic
|
||||||
|
Project key = petclinic
|
||||||
|
Main branch name = main
|
||||||
|
- Choose the following option: global branch setting
|
||||||
|
- Choose the following Analysis Method: Locally
|
||||||
|
- Generate a project token
|
||||||
|
|
||||||
|
3. Set sonar token
|
||||||
|
- Copy the generated project token to clipboard
|
||||||
|
- In your workspace, set the token environment variable (MY_SONAR_TOKEN)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export MY_SONAR_TOKEN=<paste_token_here>
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Run static analysis
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run \
|
||||||
|
--rm \
|
||||||
|
-e SONAR_HOST_URL=http://sonarqube:9000/ \
|
||||||
|
-e SONAR_TOKEN=$MY_SONAR_TOKEN \
|
||||||
|
-v "./:/usr/src" --network=spring-petclinic_custom-network\
|
||||||
|
sonarsource/sonar-scanner-cli
|
||||||
|
```
|
Loading…
Reference in a new issue