Project: Restaurant Company
Role: DevOps Engineer
Goal
Today you learned:
Lint
Test concept
SonarQube
Trivy
Quality Gate
Troubleshooting
Parallel Jobs
Dependent Jobs
Your homework is to prove that you understand these concepts and can work with the tools.
Part 1 — Verify SonarQube
Start by checking Docker:
docker ps
If SonarQube is stopped:
docker ps -a
docker start sonarqube
Check:
docker ps
Then:
curl http://localhost:9000
You should confirm that SonarQube responds.
Question: What does successful curl localhost:9000 prove?
Part 2 — Check the SonarQube Project
Open:
http://YOUR-EC2-PUBLIC-IP:9000
Log into SonarQube and find the Restaurant Company project you created in class.
Students should take a screenshot showing the project.
Then answer:
1. What is SonarQube?
2. Is SonarQube the same thing as CI?
3. What is a Quality Gate?
4. Does creating a SonarQube project automatically scan source code?
5. What is SonarScanner used for?
Part 3 — Practice Troubleshooting
Run:
free -h
Then:
docker ps
Then:
docker logs --tail 30 sonarqube
Students must explain:
What is RAM?
What is OOM?
What does exit code 137 usually indicate in the incident
we investigated?
Why did Linux kill the SonarQube Java process?
Why did increasing EC2 memory solve the problem?
Then write this troubleshooting sequence in their own words:
PROBLEM
↓
CHECK LOGS
↓
FIND EVIDENCE
↓
FIND ROOT CAUSE
↓
FIX
↓
VERIFY
And remember:
CHECK → FIND → FIX → VERIFY
Part 4 — Trivy
Students should explain:
1. What is Trivy?
2. What is a vulnerability?
3. What is CVE?
4. What does severity mean?
5. What are LOW, MEDIUM, HIGH and CRITICAL?
6. What is the difference between the primary roles
of SonarQube and Trivy?
Don't require them to claim that SonarQube is “only quality” or Trivy is “only security.” Their capabilities can overlap.
A good simple answer is:
SonarQube
→ primarily code quality/static analysis in our pipeline
Trivy
→ security scanning for known vulnerabilities
and other supported security issues
Part 5 — Design the CI Pipeline
Have students draw this architecture themselves:
┌── LINT ─────────┐
│ │
PULL REQUEST ───────┼── SONARQUBE ─────┼──→ ALL PASS
│ │
└── TRIVY ─────────┘
Then answer:
Why can these jobs run in parallel?
Expected concept:
They are independent checks and don't necessarily need the output of each other.
Part 6 — Add a Dependent Job
Now add:
┌── LINT ─────────┐
│ │
PULL REQUEST ───────┼── SONARQUBE ─────┼──→ ALL PASS
│ │
└── TRIVY ─────────┘
↓
ARTIFACT BUILD
Students should write:
needs:
- lint
- sonarqube
- trivy
Then explain:
What does
needsmean in GitHub Actions?
Expected:
needscreates a dependency between jobs. The dependent job waits for the required jobs to complete successfully.
Part 7 — Interview Practice
Every student should be able to say this without reading:
In our CI pipeline, we use SonarQube for code-quality analysis and Trivy for security scanning. Independent checks can run in parallel to reduce pipeline time. A later build job can depend on those required checks using
needs. We also troubleshot a real SonarQube failure where Linux killed the Java process because the EC2 instance ran out of memory.
Top comments (0)