Create a minimal pipeline
Write a `.gitlab-ci.yml` with `build` and `test` stages for a Node.js app. Use `node:20`, run `npm ci`, `npm run build`, and `npm test`.
DevOps & Tooling / Knowledge library
integrated pipelines for build, test, and deploy
GitLab CI/CD automates software delivery inside the same platform where code is planned, reviewed, and merged. It reduces manual release steps, catches defects earlier, standardizes deployments, and adds traceability for audits and incident response.
GitLab CI started as a separate project before being integrated into core GitLab around the GitLab 8.x era. The `.gitlab-ci.yml` file became the central declarative format for defining jobs, stages, and rules. GitLab Runner evolved from early runner tooling into a multi-executor system (shell, Docker, Kubernetes, and more). Capabilities such as Auto DevOps, review apps, child pipelines, and merge trains broadened CI/CD from simple testing to full delivery orchestration.
Work through these exercises in order. Try the task before opening a reference.
Write a `.gitlab-ci.yml` with `build` and `test` stages for a Node.js app. Use `node:20`, run `npm ci`, `npm run build`, and `npm test`.
Add caching and artifacts so tests can reuse dependencies and build output. Use `needs` to reduce stage wait time.
Add a `deploy_prod` job that runs only on `main`, requires a manual action, and publishes an environment named `production`.
Refactor one large pipeline into parent-child pipelines. Keep lint/test in parent and trigger service-specific child pipelines.
Add a merge-request pipeline rule that runs SAST and fails the pipeline on high-severity findings.
A regional logistics firm managing a fleet of autonomous delivery drones that requires frequent firmware updates to navigation software.
Manual deployment processes lead to inconsistent firmware versions across the drone fleet, resulting in navigation errors and significant downtime during manual troubleshooting.
GitLab CI/CD provides an integrated pipeline that enforces a standardized build, test, and deployment sequence, ensuring every firmware update is validated against automated test suites before being pushed to the fleet management server.
The sequence of automated actions triggered by a code commit.
Developer pushes firmware update
Compiles firmware binary
Validates navigation logic
Pushes to fleet server
This configuration maps to the Automated Logistics Fleet Deployment scenario by defining the mandatory stages to ensure firmware is built, tested, and deployed in a controlled, secure manner.
stages:
- build
- test
- deploy
build_firmware:
stage: build
script: make compile # Compiles the drone firmware
test_firmware:
stage: test
script: ./run_nav_tests.sh # Validates navigation logic
deploy_to_fleet:
stage: deploy
script: ./push_to_server.sh # Deploys to fleet management server
variables:
API_KEY: $SECURE_API_KEY # Uses protected variable for securityA reliable, repeatable deployment process that eliminates configuration drift and ensures only verified firmware reaches the production drone fleet.
A primary limitation is the potential for pipeline bottlenecks if too many jobs are queued for a single runner; this can be checked by monitoring the job queue duration in the GitLab CI/CD pipeline dashboard.