Project: Restaurant Company
Topic: Token → SonarScanner → Analysis → SonarQube Dashboard
Part 1 — Verify SonarQube connectivity
From your Restaurant Company EC2, run:
cd ~/restaurant-company
curl -I http://YOUR-SONARQUBE-IP:9000
Take a screenshot showing the HTTP response.
Answer in your own words:
What does HTTP 200 prove?
Expected concept: the EC2 can communicate with the SonarQube Server on port 9000.
Part 2 — Explain the configuration
Run:
cat sonar-project.properties
Your file should look similar to:
sonar.projectKey=restaurant-company
sonar.projectName=Restaurant Company
sonar.sources=src
sonar.sourceEncoding=UTF-8
Explain each property in one sentence:
sonar.projectKey =
sonar.projectName =
sonar.sources =
sonar.sourceEncoding =
Part 3 — SonarQube vs SonarScanner
Students must draw this architecture:
Restaurant Company
Source Code
↓
SonarScanner
↓
Analysis Report
↓
SonarQube Server :9000
↓
Restaurant Company Dashboard
↓
Quality Gate
Then answer:
1. What is SonarQube?
2. What is SonarScanner?
3. Why do we need both?
Part 4 — Token
Answer:
1. What is SONAR_TOKEN?
2. Why does SonarScanner need it?
3. Why should we never commit a real token to GitHub?
4. What is authentication?
Do not submit a screenshot containing the real token.
Students can verify that the variable exists without displaying the secret:
test -n "$SONAR_TOKEN" && echo "TOKEN IS SET"
Part 5 — Run the SonarQube analysis
From:
cd ~/restaurant-company
Run the same SonarScanner command used in class.
The student should find these messages:
Analysis report generated
Analysis report compressed
Analysis report uploaded
ANALYSIS SUCCESSFUL
SonarScanner Engine completed successfully
EXECUTION SUCCESS
Take a screenshot showing:
ANALYSIS SUCCESSFUL
Then explain:
What happened between starting SonarScanner
and seeing ANALYSIS SUCCESSFUL?
Expected flow:
READ SOURCE
↓
ANALYZE
↓
GENERATE REPORT
↓
COMPRESS REPORT
↓
UPLOAD REPORT
↓
SONARQUBE PROCESSES REPORT
Part 6 — SCM and Git
Find this part of the scanner output:
SCM Publisher
Answer:
1. What does SCM stand for?
2. Which SCM are we using?
3. What is a Git revision/commit ID?
4. Why is connecting an analysis to a Git revision useful?
Part 7 — SonarQube Dashboard
Open the Restaurant Company dashboard.
Take one screenshot of the dashboard.
Record what your current dashboard shows:
Quality Gate:
Security:
Reliability:
Maintainability:
Coverage:
Duplications:
Lines of Code:
Languages:
Your results may differ from another student's results.
Then answer:
Does Quality Gate PASSED mean there are zero issues?
Explain why.
Part 8 — Explain the metrics
Write one or two sentences explaining each:
Quality Gate
Security
Reliability
Maintainability
Security Hotspot
Coverage
Duplications
Lines of Code
Important:
PASSED ≠ PERFECT CODE
A Quality Gate can pass while SonarQube still reports issues because the gate evaluates its configured conditions.
Part 9 — Explain our 0% Coverage
Answer:
Why did our SonarQube dashboard show 0.0% Coverage?
Does SonarQube automatically create unit tests?
Where does Coverage data normally come from?
Draw:
TESTS
↓
COVERAGE TOOL
↓
COVERAGE REPORT
↓
SONARQUBE
↓
COVERAGE %
Part 10 — Interview Practice
Students should be able to say this without reading:
In our project, we use SonarScanner to analyze the Restaurant Company source code and submit the analysis to SonarQube. SonarQube processes and displays the results, including security, reliability, maintainability, coverage, duplications, and the Quality Gate. We use a token to authenticate the scanner to the SonarQube Server. A passed Quality Gate does not necessarily mean that the code has zero issues.
Top comments (0)