In this guide, we’ll walk through the GitLab CI/CD workflow for building, testing, and deploying the XYZ team’s Node.js application. Every commit in the GitLab repository triggers a sequence of automated stages—running tests, measuring code coverage, building Docker images, and deploying to Kubernetes clusters—culminating in manual approval and production rollout.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Pipeline Overview
| Stage | Description | Failure Behavior |
|---|---|---|
| 1. Unit Testing | Install dependencies and run unit tests | Stops on failure |
| 2. Code Coverage | Parallel jobs: test-report & coverage-analysis | Coverage errors ignored |
| 3. Containerization | Build, smoke-test, and push Docker image | Stops on failure |
| 4. Deploy to Development | Apply Kubernetes manifests to the dev cluster and fetch ingress URL | Stops on failure |
| 5. Integration Testing | Verify service health via the dev endpoint | Stops on failure |
| 6. Manual Approval | Human gate before production deployment | Pauses pipeline until approved |
| 7. Deploy to Production | Apply manifests to the prod cluster and fetch ingress URL | Stops on failure |
| 8. Post-Deployment Integration Testing | Validate production health via the live endpoint | Stops on failure |
1. Unit Testing
Install dependencies with npm and execute all unit tests. Any failure aborts the pipeline immediately.Store your test reports (e.g., JUnit XML) as artifacts for later analysis or reporting.
2. Code Coverage
Run two parallel jobs:- Test Report: Fails on test errors.
- Coverage Analysis: Runs coverage but ignores errors to avoid blocking downstream stages.
Ignoring coverage errors ensures that a slight dip in metrics doesn’t halt deployments.
3. Containerization
Build and push a Docker image tagged with the commit SHA. Optionally, smoke-test the container before pushing.4. Deploy to Development
Apply Kubernetes manifests to the development cluster and retrieve the ingress hostname.Ensure your kubeconfig is configured with the
dev context. See Kubernetes docs.5. Integration Testing
Validate the development deployment by hitting the health endpoint.6. Manual Approval
A developer or reviewer must approve the pipeline before production rollout. If declined, the pipeline stops here.Do not skip this step. Manual gates help prevent unintended production changes.