How devezro/ci-cd-sonarqube-test works
Main Components
• GitHub Repository:
• Contains the source code (the Java files in src/) and example code (under examples/).
• Holds configuration files such as docker-compose.yml and GitHub Actions workflow (in .github/workflows/workflow.yml).
• GitHub Actions CI/CD Pipeline:
• Jobs triggered on pushes (commits and pushes in Git).
• That the workflow picks up the Java code changes and initiates analysis.
• Docker Environment:
• Docker Compose configuration that spins up the SonarQube server and its Postgres database.
• SonarQube Service:
• The core analysis tool where the code is scanned.
• Dependent on Postgres as its database.
• Ngrok (Optional):
• A tunneling service that exposes the SonarQube instance to the public internet when needed.
• Developer/User Interaction:
• Local development and committing process that triggers the CI pipeline.
Relationships and Interactions
• From the repository, illustrate that a commit triggers the GitHub Actions workflow (the job is defined in .github/workflows/workflow.yml).
• Within the workflow:
• That the Java source code from /src (and changes from examples) is built or scanned.
• The workflow communicates with the SonarQube server (via the configured host URL and token, as mentioned in the README).
• Docker Compose-managed environment: the SonarQube container interlinked with the Postgres DB container.
Architectural Patterns and Design Principles
• CI/CD integration: code commit → GitHub Actions → analysis on SonarQube.
• Use of containerization for environment consistency (SonarQube + Postgres via Docker).
• Separation of concerns: the repository holds distinct responsibilities (source code, examples, and workflows) that trigger external services.
Relevant Technologies, Frameworks, and Libraries
• Java for the implementation (located in src/com/example/sqlinjectiontest).
• Docker Compose governing the deployment of SonarQube and Postgres.
• GitHub Actions as the CI platform.
• SonarQube for code quality and security analysis.
• Ngrok as an optional tunneling service for external access.
Final Touches
• Annotations on how external configuration (like GitHub repository secrets for SONAR_TOKEN, Docker settings in docker-compose.yml, and modifications in the workflow.yml) influence the overall system.