Continuous Integration and Continuous Deployment (CI/CD)
The deployed application consists of two microservices (frontend and backend) and uses a CI/CD pipeline to automate integration and deployment. Both projects have separate branches for different environments: main for production, pre for preproduction, and dev for development. Each branch has its own CI/CD pipeline, with environment-specific configurations and steps.
Running the CI/CD Pipeline
Each project includes a .gitlab-ci.yml file at its root to run the pipeline through GitLab. This file defines the steps required to build, test, and deploy the application. In this case, the .gitlab-ci.yml file contains the following statement to include pipelines from the ci-pipelines project:
include:
- project: 'tfg-gabriel-canals/ci-pipelines'
ref: main
file: '/environment/preproduction/.preproduction-base.yml'
The ci-pipelines project contains the CI/CD pipelines for each environment, which run according to the branch receiving the commit.
CI/CD Pipeline Breakdown
The CI/CD pipeline has environment-specific stages. In general, its structure is illustrated below:

Whenever a commit is pushed to one of the three branches (main, pre, or dev), the corresponding CI/CD pipeline runs. It includes the following stages:
1. quality: Runs code quality checks, such as static analysis.
2. security: Performs security scans to identify vulnerable dependencies and possible secret exposure.
3. results-scanners: Generates reports from the scans performed in the preceding stages.
4. install-dependencies: Installs the project's required dependencies using npm.
5. test: Runs unit tests to verify application behavior and ensure coverage requirements are met.
6. build: Builds the project and generates the files required for deployment.
7. container-build: Builds Docker container images for the frontend and backend and pushes them to the project's GitLab container registry. Each image is tagged with the commit hash, allowing every version to be identified uniquely.
8. deploy: Updates the Kubernetes deployment manifest to reference the newly tagged container image. It then pushes the updated manifest to the GitLab repository, triggering deployment to the Kubernetes cluster for the corresponding environment through ArgoCD.
9. e2e-tests: In preproduction, runs Cypress E2E tests to verify that the application works correctly in a real environment. These tests cover major features, including user registration, login, article creation and editing, and comments.